You are here

public function View::buildOptionsForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/area/View.php \Drupal\views\Plugin\views\area\View::buildOptionsForm()
  2. 9 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.'),
  ];
}