You are here

public function ConfigDevelSettingsForm::buildForm in Configuration development 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 ConfigFormBase::buildForm

File

src/Form/ConfigDevelSettingsForm.php, line 27

Class

ConfigDevelSettingsForm
Settings form for config devel.

Namespace

Drupal\config_devel\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $default_value = '';
  foreach ($this
    ->config(static::CONFIGNAME)
    ->get('auto_import') as $file) {
    $default_value .= $file['filename'] . "\n";
  }
  $form['auto_import'] = array(
    '#type' => 'textarea',
    '#title' => $this
      ->t('Auto import'),
    '#default_value' => $default_value,
    '#description' => $this
      ->t('When these files change, they will be automatically imported at the beginning of the next request.') . '<br>' . $this
      ->t('Enter one item per line. Each item should consist of a path relative to the Drupal root and a filename in the same form as a config YML file.') . '<br>' . $this
      ->t('For example: "modules/mymodule/config/install/node.type.mytype.yml".'),
  );
  $form['auto_export'] = array(
    '#type' => 'textarea',
    '#title' => $this
      ->t('Auto export'),
    '#default_value' => implode("\n", $this
      ->config(static::CONFIGNAME)
      ->get('auto_export')),
    '#description' => $this
      ->t('Automatically export to the files specified when the corresponding config item is changed in the admin UI.') . '<br>' . $this
      ->t('Enter one item per line. Each item should consist of a path relative to the Drupal root and a filename in the same form as a config YML file.') . '<br>' . $this
      ->t('For example: "modules/mymodule/config/install/node.type.mytype.yml".'),
  );
  return parent::buildForm($form, $form_state);
}