function DisplayPluginBase::defineOptions

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

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides PluginBase::defineOptions

7 calls to DisplayPluginBase::defineOptions()
Attachment::defineOptions in core/modules/views/src/Plugin/views/display/Attachment.php
Block::defineOptions in core/modules/views/src/Plugin/views/display/Block.php
DisplayPluginBase::initDisplay in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
DisplayPluginBase::mergeDefaults in core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
DisplayTest::defineOptions in core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php

... See full list

5 methods override DisplayPluginBase::defineOptions()
Attachment::defineOptions in core/modules/views/src/Plugin/views/display/Attachment.php
Block::defineOptions in core/modules/views/src/Plugin/views/display/Block.php
DisplayTest::defineOptions in core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php
EntityReference::defineOptions in core/modules/views/src/Plugin/views/display/EntityReference.php
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 458

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.