function EditDetails::buildForm

Same name in other branches
  1. 9 core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::buildForm()
  2. 8.9.x core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::buildForm()
  3. 11.x core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::buildForm()

Overrides FormInterface::buildForm

File

core/modules/views_ui/src/Form/Ajax/EditDetails.php, line 32

Class

EditDetails
Provides a form for editing the details of a View.

Namespace

Drupal\views_ui\Form\Ajax

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $view = $form_state->get('view');
    $form['#title'] = $this->t('Name and description');
    $form['#section'] = 'details';
    $form['details'] = [
        '#theme_wrappers' => [
            'container',
        ],
        '#attributes' => [
            'class' => [
                'scroll',
            ],
            'data-drupal-views-scroll' => TRUE,
        ],
    ];
    $form['details']['label'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Administrative name'),
        '#default_value' => $view->label(),
    ];
    $form['details']['langcode'] = [
        '#type' => 'language_select',
        '#title' => $this->t('View language'),
        '#description' => $this->t('Language of labels and other textual elements in this view.'),
        '#default_value' => $view->get('langcode'),
    ];
    $form['details']['description'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Administrative description'),
        '#default_value' => $view->get('description'),
    ];
    $form['details']['tag'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Administrative tags'),
        '#description' => $this->t('Enter a comma-separated list of words to describe your view.'),
        '#default_value' => $view->get('tag'),
        '#autocomplete_route_name' => 'views_ui.autocomplete',
    ];
    $view->getStandardButtons($form, $form_state, 'views_ui_edit_details_form');
    return $form;
}

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