You are here

public function PathFilterForm::buildForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/path/src/Form/PathFilterForm.php \Drupal\path\Form\PathFilterForm::buildForm()
  2. 10 core/modules/path/src/Form/PathFilterForm.php \Drupal\path\Form\PathFilterForm::buildForm()

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

core/modules/path/src/Form/PathFilterForm.php, line 25

Class

PathFilterForm
Provides the path admin overview filter form.

Namespace

Drupal\path\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $keys = NULL) {
  $form['#attributes'] = [
    'class' => [
      'search-form',
    ],
  ];
  $form['basic'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Filter aliases'),
    '#open' => TRUE,
    '#attributes' => [
      'class' => [
        'container-inline',
      ],
    ],
  ];
  $form['basic']['filter'] = [
    '#type' => 'search',
    '#title' => $this
      ->t('Path alias'),
    '#title_display' => 'invisible',
    '#default_value' => $keys,
    '#maxlength' => 128,
    '#size' => 25,
  ];
  $form['basic']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Filter'),
  ];
  if ($keys) {
    $form['basic']['reset'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Reset'),
      '#submit' => [
        '::resetForm',
      ],
    ];
  }
  return $form;
}