You are here

public function ConfigSyncInitialize::buildForm in Configuration Synchronizer 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/ConfigSyncInitialize.php, line 96

Class

ConfigSyncInitialize

Namespace

Drupal\config_sync\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $changelists = $this->configSyncLister
    ->getExtensionChangelists();
  if (!empty($changelists)) {
    foreach ($changelists as $type => $extension_changelists) {
      $form[$type] = $this
        ->buildUpdatesListing($type, $extension_changelists);
    }
    $form['retain_active_overrides'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Retain customizations'),
      '#default_value' => TRUE,
      '#description' => $this
        ->t('If you select this option, configuration updates will be merged into the active configuration, retaining any customizations.'),
    ];
    $form['message'] = [
      '#markup' => $this
        ->t('Use the button below to initialize data to be imported from updated modules and themes.'),
    ];
    $form['actions'] = [
      '#type' => 'actions',
    ];
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Initialize'),
    ];
  }
  else {
    $form['message'] = [
      '#markup' => $this
        ->t('No configuration updates are available from installed modules and themes.'),
    ];
  }
  return $form;
}