function Page::submitOptionsForm

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::submitOptionsForm()
  2. 8.9.x core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::submitOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::submitOptionsForm()

Overrides PathPluginBase::submitOptionsForm

File

core/modules/views/src/Plugin/views/display/Page.php, line 520

Class

Page
The plugin that handles a full page.

Namespace

Drupal\views\Plugin\views\display

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
    parent::submitOptionsForm($form, $form_state);
    switch ($form_state->get('section')) {
        case 'menu':
            $menu = $form_state->getValue('menu');
            [
                $menu['menu_name'],
                $menu['parent'],
            ] = explode(':', $menu['parent'], 2);
            $this->setOption('menu', $menu);
            // send ajax form to options page if we use it.
            if ($form_state->getValue([
                'menu',
                'type',
            ]) == 'default tab') {
                $form_state->get('view')
                    ->addFormToStack('display', $this->display['id'], 'tab_options');
            }
            break;
        case 'tab_options':
            $this->setOption('tab_options', $form_state->getValue('tab_options'));
            break;
        case 'use_admin_theme':
            if ($form_state->getValue('use_admin_theme')) {
                $this->setOption('use_admin_theme', $form_state->getValue('use_admin_theme'));
            }
            else {
                unset($this->options['use_admin_theme']);
                unset($this->display['display_options']['use_admin_theme']);
            }
            break;
    }
}

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