function View::buildOptionsForm

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/area/View.php \Drupal\views\Plugin\views\area\View::buildOptionsForm()
  2. 8.9.x core/modules/views/src/Plugin/views/area/View.php \Drupal\views\Plugin\views\area\View::buildOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/area/View.php \Drupal\views\Plugin\views\area\View::buildOptionsForm()

Overrides AreaPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/area/View.php, line 77

Class

View
Views area handlers. Insert a view inside of an area.

Namespace

Drupal\views\Plugin\views\area

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $view_display = $this->view->storage
        ->id() . ':' . $this->view->current_display;
    $options = [
        '' => $this->t('-Select-'),
    ];
    $options += Views::getViewsAsOptions(FALSE, 'all', $view_display, FALSE, TRUE);
    $form['view_to_insert'] = [
        '#type' => 'select',
        '#title' => $this->t('View to insert'),
        '#default_value' => $this->options['view_to_insert'],
        '#description' => $this->t('The view to insert into this area.'),
        '#options' => $options,
    ];
    $form['inherit_arguments'] = [
        '#type' => 'checkbox',
        '#title' => $this->t('Inherit contextual filters'),
        '#default_value' => $this->options['inherit_arguments'],
        '#description' => $this->t('If checked, this view will receive the same contextual filters as its parent.'),
    ];
}

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