function DisplayPluginBase::defineOptions

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

Overrides PluginBase::defineOptions

2 calls to DisplayPluginBase::defineOptions()
DisplayPluginBase::initDisplay in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Initializes the display plugin.
DisplayPluginBase::mergeDefaults in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
Merges default values for all plugin types.
5 methods override DisplayPluginBase::defineOptions()
Attachment::defineOptions in core/modules/views/src/Plugin/views/display/Attachment.php
Information about options for all kinds of purposes will be held here.
Block::defineOptions in core/modules/views/src/Plugin/views/display/Block.php
Information about options for all kinds of purposes will be held here.
DisplayTest::defineOptions in core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php
Information about options for all kinds of purposes will be held here.
EntityReference::defineOptions in core/modules/views/src/Plugin/views/display/EntityReference.php
Information about options for all kinds of purposes will be held here.
PathPluginBase::defineOptions in core/modules/views/src/Plugin/views/display/PathPluginBase.php
Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase:defineOptions().

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 466

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

protected function defineOptions() {
    $options = [
        'defaults' => [
            'default' => [
                'access' => TRUE,
                'cache' => TRUE,
                'query' => TRUE,
                'title' => TRUE,
                'css_class' => TRUE,
                'display_description' => FALSE,
                'use_ajax' => TRUE,
                'hide_attachment_summary' => TRUE,
                'show_admin_links' => TRUE,
                'pager' => TRUE,
                'use_more' => TRUE,
                'use_more_always' => TRUE,
                'use_more_text' => TRUE,
                'exposed_form' => TRUE,
                'link_display' => TRUE,
                'link_url' => TRUE,
                'group_by' => TRUE,
                'style' => TRUE,
                'row' => TRUE,
                'header' => TRUE,
                'footer' => TRUE,
                'empty' => TRUE,
                'relationships' => TRUE,
                'fields' => TRUE,
                'sorts' => TRUE,
                'arguments' => TRUE,
                'filters' => TRUE,
                'filter_groups' => TRUE,
            ],
        ],
        'title' => [
            'default' => '',
        ],
        'enabled' => [
            'default' => TRUE,
        ],
        'display_comment' => [
            'default' => '',
        ],
        'css_class' => [
            'default' => '',
        ],
        'display_description' => [
            'default' => '',
        ],
        'use_ajax' => [
            'default' => FALSE,
        ],
        'hide_attachment_summary' => [
            'default' => FALSE,
        ],
        'show_admin_links' => [
            'default' => TRUE,
        ],
        'use_more' => [
            'default' => FALSE,
        ],
        'use_more_always' => [
            'default' => TRUE,
        ],
        'use_more_text' => [
            'default' => 'more',
        ],
        'link_display' => [
            'default' => '',
        ],
        'link_url' => [
            'default' => '',
        ],
        'group_by' => [
            'default' => FALSE,
        ],
        'rendering_language' => [
            'default' => '***LANGUAGE_entity_translation***',
        ],
        // These types are all plugins that can have individual settings
        // and therefore need special handling.
'access' => [
            'contains' => [
                'type' => [
                    'default' => 'none',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'cache' => [
            'contains' => [
                'type' => [
                    'default' => 'tag',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'query' => [
            'contains' => [
                'type' => [
                    'default' => 'views_query',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'exposed_form' => [
            'contains' => [
                'type' => [
                    'default' => 'basic',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'pager' => [
            'contains' => [
                'type' => [
                    'default' => 'mini',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'style' => [
            'contains' => [
                'type' => [
                    'default' => 'default',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'row' => [
            'contains' => [
                'type' => [
                    'default' => 'fields',
                ],
                'options' => [
                    'default' => [],
                ],
            ],
            'merge_defaults' => [
                $this,
                'mergePlugin',
            ],
        ],
        'exposed_block' => [
            'default' => FALSE,
        ],
        'header' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        'footer' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        'empty' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        // We want these to export last.
        // These are the 5 handler types.
'relationships' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        'fields' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        'sorts' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        'arguments' => [
            'default' => [],
            'merge_defaults' => [
                $this,
                'mergeHandler',
            ],
        ],
        'filter_groups' => [
            'contains' => [
                'operator' => [
                    'default' => 'AND',
                ],
                'groups' => [
                    'default' => [
                        1 => 'AND',
                    ],
                ],
            ],
        ],
        'filters' => [
            'default' => [],
        ],
    ];
    if (!$this->usesPager()) {
        $options['defaults']['default']['pager'] = FALSE;
        $options['pager']['contains']['type']['default'] = 'some';
    }
    if ($this->isDefaultDisplay()) {
        unset($options['defaults']);
    }
    $options['display_extenders'] = [
        'default' => [],
    ];
    // First allow display extenders to provide new options.
    foreach ($this->extenders as $extender_id => $extender) {
        $options['display_extenders']['contains'][$extender_id]['contains'] = $extender->defineOptions();
    }
    // Then allow display extenders to alter existing default values.
    foreach ($this->extenders as $extender) {
        $extender->defineOptionsAlter($options);
    }
    return $options;
}

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