function PathFilterForm::buildForm

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.