You are here

function views_plugin_display::option_definition in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_display.inc \views_plugin_display::option_definition()
  2. 7.3 plugins/views_plugin_display.inc \views_plugin_display::option_definition()

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


'option_name' => array(
 - 'default' => default value,
 - 'translatable' => TRUE/FALSE (wrap in t() on export if true),
 - 'contains' => array of items this contains, with its own defaults, etc.
     If contains is set, the default will be ignored and assumed to
     be array()

 ),
 

Each option may have any of the following functions:

  • export_option_OPTIONNAME -- Special export handling if necessary.
  • translate_option_OPTIONNAME -- Special handling for translating data within the option, if necessary.

Overrides views_object::option_definition

3 calls to views_plugin_display::option_definition()
views_plugin_display_attachment::option_definition in plugins/views_plugin_display_attachment.inc
Information about options for all kinds of purposes will be held here.
views_plugin_display_block::option_definition in plugins/views_plugin_display_block.inc
Information about options for all kinds of purposes will be held here.
views_plugin_display_page::option_definition in plugins/views_plugin_display_page.inc
Information about options for all kinds of purposes will be held here.
3 methods override views_plugin_display::option_definition()
views_plugin_display_attachment::option_definition in plugins/views_plugin_display_attachment.inc
Information about options for all kinds of purposes will be held here.
views_plugin_display_block::option_definition in plugins/views_plugin_display_block.inc
Information about options for all kinds of purposes will be held here.
views_plugin_display_page::option_definition in plugins/views_plugin_display_page.inc
Information about options for all kinds of purposes will be held here.

File

plugins/views_plugin_display.inc, line 406
Contains the base display plugin.

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

function option_definition() {
  $options = array(
    'defaults' => array(
      'default' => array(
        'access' => TRUE,
        'cache' => TRUE,
        'query' => TRUE,
        'title' => TRUE,
        'css_class' => TRUE,
        'display_description' => FALSE,
        'use_ajax' => TRUE,
        'hide_attachment_summary' => TRUE,
        'pager' => TRUE,
        'pager_options' => TRUE,
        'use_more' => TRUE,
        'use_more_always' => TRUE,
        'use_more_text' => TRUE,
        'exposed_form' => TRUE,
        'exposed_form_options' => TRUE,
        'link_display' => TRUE,
        'link_url' => '',
        'group_by' => TRUE,
        'style_plugin' => TRUE,
        'style_options' => TRUE,
        'row_plugin' => TRUE,
        'row_options' => TRUE,
        'header' => TRUE,
        'footer' => TRUE,
        'empty' => TRUE,
        'relationships' => TRUE,
        'fields' => TRUE,
        'sorts' => TRUE,
        'arguments' => TRUE,
        'filters' => TRUE,
        'filter_groups' => TRUE,
      ),
      'export' => FALSE,
    ),
    'title' => array(
      'default' => '',
      'translatable' => TRUE,
    ),
    'enabled' => array(
      'default' => TRUE,
      'translatable' => FALSE,
      'bool' => TRUE,
    ),
    'display_comment' => array(
      'default' => '',
    ),
    'css_class' => array(
      'default' => '',
      'translatable' => FALSE,
    ),
    'display_description' => array(
      'default' => '',
      'translatable' => TRUE,
    ),
    'use_ajax' => array(
      'default' => FALSE,
      'bool' => TRUE,
    ),
    'hide_attachment_summary' => array(
      'default' => FALSE,
      'bool' => TRUE,
    ),
    // This is legacy code:
    // Items_per/offset/use_pager is moved to the pager plugin
    // but the automatic update path needs this items defined, so don't remove it.
    // @see views_plugin_display::init()
    'items_per_page' => array(
      'default' => 10,
    ),
    'offset' => array(
      'default' => 0,
    ),
    'use_pager' => array(
      'default' => FALSE,
      'bool' => TRUE,
    ),
    'use_more' => array(
      'default' => FALSE,
      'bool' => TRUE,
    ),
    'use_more_always' => array(
      'default' => FALSE,
      'bool' => FALSE,
    ),
    'use_more_text' => array(
      'default' => 'more',
      'translatable' => TRUE,
    ),
    'link_display' => array(
      'default' => '',
    ),
    'link_url' => array(
      'default' => '',
    ),
    'group_by' => array(
      'default' => FALSE,
      'bool' => TRUE,
    ),
    // These types are all plugins that can have individual settings
    // and therefore need special handling.
    'access' => array(
      'contains' => array(
        'type' => array(
          'default' => 'none',
          'export' => 'export_plugin',
          'unpack_translatable' => 'unpack_plugin',
        ),
      ),
    ),
    'cache' => array(
      'contains' => array(
        'type' => array(
          'default' => 'none',
          'export' => 'export_plugin',
          'unpack_translatable' => 'unpack_plugin',
        ),
      ),
    ),
    'query' => array(
      'contains' => array(
        'type' => array(
          'default' => 'views_query',
          'export' => 'export_plugin',
        ),
        'options' => array(
          'default' => array(),
          'export' => FALSE,
        ),
      ),
    ),
    // Note that exposed_form plugin has options in a separate array,
    // while access and cache do not. access and cache are legacy and
    // that pattern should not be repeated, but it is left as is to
    // reduce the need to modify older views. Let's consider the
    // pattern used here to be the template from which future plugins
    // should be copied.
    'exposed_form' => array(
      'contains' => array(
        'type' => array(
          'default' => 'basic',
          'export' => 'export_plugin',
          'unpack_translatable' => 'unpack_plugin',
        ),
        'options' => array(
          'default' => array(),
          'export' => FALSE,
        ),
      ),
    ),
    'pager' => array(
      'contains' => array(
        'type' => array(
          'default' => 'full',
          'export' => 'export_plugin',
          'unpack_translatable' => 'unpack_plugin',
        ),
        'options' => array(
          'default' => array(),
          'export' => FALSE,
        ),
      ),
    ),
    // Note that the styles have their options completely independent.
    // Like access and cache above, this is a legacy pattern and
    // should not be repeated.
    'style_plugin' => array(
      'default' => 'default',
      'export' => 'export_style',
      'unpack_translatable' => 'unpack_style',
    ),
    'style_options' => array(
      'default' => array(),
      'export' => FALSE,
    ),
    'row_plugin' => array(
      'default' => 'fields',
      'export' => 'export_style',
      'unpack_translatable' => 'unpack_style',
    ),
    'row_options' => array(
      'default' => array(),
      'export' => FALSE,
    ),
    'exposed_block' => array(
      'default' => FALSE,
    ),
    'header' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    'footer' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    'empty' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    // We want these to export last.
    // These are the 5 handler types.
    'relationships' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    'fields' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    'sorts' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    'arguments' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
    'filter_groups' => array(
      'contains' => array(
        'operator' => array(
          'default' => 'AND',
        ),
        'groups' => array(
          'default' => array(
            1 => 'AND',
          ),
        ),
      ),
    ),
    'filters' => array(
      'default' => array(),
      'export' => 'export_handler',
      'unpack_translatable' => 'unpack_handler',
    ),
  );
  if (empty($this->definition['use pager'])) {
    $options['defaults']['default']['use_pager'] = FALSE;
    $options['defaults']['default']['items_per_page'] = FALSE;
    $options['defaults']['default']['offset'] = FALSE;
    $options['defaults']['default']['pager'] = FALSE;
    $options['pager']['contains']['type']['default'] = 'some';
  }
  if ($this
    ->is_default_display()) {
    unset($options['defaults']);
  }
  foreach ($this->extender as $extender) {
    $extender
      ->option_definition($options);
  }
  return $options;
}