You are here

public function SettingsForm::buildForm in Sub-pathauto (Sub-path URL Aliases) 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/SettingsForm.php, line 17

Class

SettingsForm
Defines a form that configures Subpathauto.

Namespace

Drupal\subpathauto\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('subpathauto.settings');
  $form['depth'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Maximum depth of sub-paths to alias'),
    '#options' => array_merge([
      0 => $this
        ->t('Disabled'),
    ], range(1, MenuTreeStorage::MAX_DEPTH - 1)),
    '#default_value' => $config
      ->get('depth'),
    '#description' => $this
      ->t('Increasing this value may decrease performance.'),
  ];
  return parent::buildForm($form, $form_state);
}