+
+ if (!empty($config_directories[CONFIG_SYNC_DIRECTORY])) {
+ $sync = new FileStorage($config_directories[CONFIG_SYNC_DIRECTORY]);
+ $extensions = $sync->read('core.extension');
+ $site = $sync->read('system.site');
+ if (isset($site['name']) && isset($extensions['profile']) && in_array($extensions['profile'], array_keys($names), TRUE)) {
+ // Ensure the the profile can be installed from configuration. Install
+ // profile's which implement hook_INSTALL() are not supported.
+ // @todo https://www.drupal.org/project/drupal/issues/2982052 Remove
+ // this restriction.
+ module_load_install($extensions['profile']);
+ if (!function_exists($extensions['profile'] . '_install')) {
+ $form['profile']['#options'][static::CONFIG_INSTALL_PROFILE_KEY] = $this->t('Use existing configuration');
+ $form['profile'][static::CONFIG_INSTALL_PROFILE_KEY]['#description'] = [
+ 'description' => [
+ '#markup' => $this->t('Install %name using existing configuration.', ['%name' => $site['name']]),
+ ],
+ 'info' => [
+ '#type' => 'item',
+ '#markup' => $this->t('The configuration from the directory %sync_directory will be used.', ['%sync_directory' => $config_directories[CONFIG_SYNC_DIRECTORY]]),
+ '#wrapper_attributes' => [
+ 'class' => ['messages', 'messages--status'],
+ ],
+ '#states' => [
+ 'visible' => [
+ ':input[name="profile"]' => ['value' => static::CONFIG_INSTALL_PROFILE_KEY],
+ ],
+ ],
+ ],
+ ];
+ }
+ }
+ }
+