You are here

public function PathFilterForm::buildForm in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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 28
Contains \Drupal\path\Form\PathFilterForm.

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'] = array(
    'class' => array(
      'search-form',
    ),
  );
  $form['basic'] = array(
    '#type' => 'details',
    '#title' => $this
      ->t('Filter aliases'),
    '#open' => TRUE,
    '#attributes' => array(
      'class' => array(
        'container-inline',
      ),
    ),
  );
  $form['basic']['filter'] = array(
    '#type' => 'search',
    '#title' => 'Path alias',
    '#title_display' => 'invisible',
    '#default_value' => $keys,
    '#maxlength' => 128,
    '#size' => 25,
  );
  $form['basic']['submit'] = array(
    '#type' => 'submit',
    '#button_type' => 'primary',
    '#value' => $this
      ->t('Filter'),
  );
  if ($keys) {
    $form['basic']['reset'] = array(
      '#type' => 'submit',
      '#value' => $this
        ->t('Reset'),
      '#submit' => array(
        '::resetForm',
      ),
    );
  }
  return $form;
}