1.20.x views_plugin_display.inc views_plugin_display::option_definition()

Information about options for all kinds of purposes will be held here. @code 'option_name' => array(

  • 'default' => default value,
  • 'translatable' => (optional) TRUE/FALSE,
  • '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().
  • 'bool' => (optional) TRUE/FALSE Is the value a boolean value. This will change the internal format to TRUE/FALSE instead of 1/0.

),

Return value

array: Returns the options of this handler/plugin.

Overrides views_object::option_definition

See also

views_object::unpack_translatable()

File

modules/views/plugins/views_plugin_display.inc, line 465
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,
        'hide_admin_links' => 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,
      ),
    ),

    '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,
    ),
    'hide_admin_links' => 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' => TRUE,
    ),
    'use_more_text' => array(
      'default' => 'more',
      'translatable' => TRUE,
    ),
    'link_display' => array(
      'default' => '',
    ),
    'link_url' => array(
      'default' => '',
    ),
    'group_by' => array(
      'default' => FALSE,
      'bool' => TRUE,
    ),
    'field_language' => array(
      'default' => '***CURRENT_LANGUAGE***',
    ),
    'field_language_add_to_query' => array(
      'default' => 1,
    ),

    // These types are all plugins that can have individual settings
    // and therefore need special handling.
    'access' => array(
      'contains' => array(
        'type' => array(
          'default' => 'none',
          'unpack_translatable' => 'unpack_plugin',
        ),
      ),
    ),
    'cache' => array(
      'contains' => array(
        'type' => array(
          'default' => 'none',
          'unpack_translatable' => 'unpack_plugin',
        ),
      ),
    ),
    'query' => array(
      'contains' => array(
        'type' => array('default' => 'views_query'),
        'options' => array('default' => array()),
      ),
    ),
    // 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',
          'unpack_translatable' => 'unpack_plugin',
        ),
        'options' => array('default' => array()),
      ),
    ),
    'pager' => array(
      'contains' => array(
        'type' => array(
          'default' => 'full',
          'unpack_translatable' => 'unpack_plugin',
        ),
        'options' => array('default' => array()),
      ),
    ),

    // 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',
      'unpack_translatable' => 'unpack_style',
    ),
    'style_options' => array(
      'default' => array(),
    ),
    'row_plugin' => array(
      'default' => 'fields',
      'unpack_translatable' => 'unpack_style',
    ),
    'row_options' => array(
      'default' => array(),
    ),
    'exposed_block' => array(
      'default' => FALSE,
    ),
    'header' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),
    'footer' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),
    'empty' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),

    // These are the 5 handler types.
    'relationships' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),
    'fields' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),
    'sorts' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),
    'arguments' => array(
      'default' => array(),
      'unpack_translatable' => 'unpack_handler',
    ),
    'filter_groups' => array(
      'contains' => array(
        'operator' => array('default' => 'AND'),
        'groups' => array('default' => array(1 => 'AND')),
      ),
    ),
    'filters' => array(
      'default' => array(),
      '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->options_definition_alter($options);
  }

  return $options;
}