You are here

public function NeutralPathsSettingsForm::buildForm in Neutral paths 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/NeutralPathsSettingsForm.php, line 58

Class

NeutralPathsSettingsForm
Configure file system settings for this site.

Namespace

Drupal\neutral_paths\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('neutral_paths.settings');
  $form['neutral_paths_fix_new'] = [
    '#type' => 'checkboxes',
    '#options' => [],
    '#title' => $this
      ->t('Select the types of paths to set as language neutral'),
    '#default_value' => $config
      ->get('neutral_paths_fix_new'),
  ];
  $definitions = $this->aliasTypeManager
    ->getVisibleDefinitions();
  foreach ($definitions as $id => $definition) {
    $alias_type = $this->aliasTypeManager
      ->createInstance($id);
    $form['neutral_paths_fix_new']['#options'][$id] = $alias_type
      ->getLabel();
  }
  return parent::buildForm($form, $form_state);
}