You are here

function views_plugin_display::options_summary 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::options_summary()
  2. 7.3 plugins/views_plugin_display.inc \views_plugin_display::options_summary()

Provide the default summary for options in the views UI.

This output is returned as an array.

3 calls to views_plugin_display::options_summary()
views_plugin_display_attachment::options_summary in plugins/views_plugin_display_attachment.inc
Provide the summary for attachment options in the views UI.
views_plugin_display_block::options_summary in plugins/views_plugin_display_block.inc
Provide the summary for page options in the views UI.
views_plugin_display_page::options_summary in plugins/views_plugin_display_page.inc
Provide the summary for page options in the views UI.
3 methods override views_plugin_display::options_summary()
views_plugin_display_attachment::options_summary in plugins/views_plugin_display_attachment.inc
Provide the summary for attachment options in the views UI.
views_plugin_display_block::options_summary in plugins/views_plugin_display_block.inc
Provide the summary for page options in the views UI.
views_plugin_display_page::options_summary in plugins/views_plugin_display_page.inc
Provide the summary for page options in the views UI.

File

plugins/views_plugin_display.inc, line 996
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 options_summary(&$categories, &$options) {
  $categories = array(
    'basic' => array(
      'title' => t('Basic settings'),
    ),
    'advanced' => array(
      'title' => t('Advanced settings'),
    ),
    'style' => array(
      'title' => t('Style settings'),
    ),
    'exposed' => array(
      'title' => t('Exposed form'),
    ),
  );
  if ($this->display->id != 'default') {
    $options['display_id'] = array(
      'category' => 'basic',
      'title' => t('Machine Name'),
      'value' => !empty($this->display->new_id) ? check_plain($this->display->new_id) : check_plain($this->display->id),
      'desc' => t('Change the machine name of this display.'),
    );
  }
  $options['display_title'] = array(
    'category' => 'basic',
    'title' => t('Name'),
    'value' => check_plain($this->display->display_title),
    'desc' => t('Change the name of this display.'),
  );
  $display_comment = check_plain(drupal_substr($this
    ->get_option('display_comment'), 0, 10));
  $options['display_comment'] = array(
    'category' => 'basic',
    'title' => t('Comment'),
    'value' => !empty($display_comment) ? $display_comment : t('No comment'),
    'desc' => t('Comment or document this display.'),
  );
  $title = strip_tags($this
    ->get_option('title'));
  if (!$title) {
    $title = t('None');
  }
  $options['title'] = array(
    'category' => 'basic',
    'title' => t('Title'),
    'value' => $title,
    'desc' => t('Change the title that this display will use.'),
  );
  $options['enabled'] = array(
    'category' => 'basic',
    'title' => t('Display status'),
    'value' => $this
      ->get_option('enabled') ? t('Enabled') : t('Disabled'),
    'desc' => t('Define if this display is or is not enabled.'),
  );
  $style_plugin = views_fetch_plugin_data('style', $this
    ->get_option('style_plugin'));
  $style_title = empty($style_plugin['title']) ? t('Missing style plugin') : $style_plugin['title'];
  $style = '';
  $options['style_plugin'] = array(
    'category' => 'style',
    'title' => t('Style'),
    'value' => $style_title,
    'desc' => t('Change the style plugin.'),
  );

  // This adds a 'Settings' link to the style_options setting if the style has options.
  if (!empty($style_plugin['uses options'])) {
    $options['style_plugin']['links']['style_options'] = t('Change settings for this style');
  }
  if (!empty($style_plugin['uses row plugin'])) {
    $row_plugin = views_fetch_plugin_data('row', $this
      ->get_option('row_plugin'));
    $row_title = empty($row_plugin['title']) ? t('Missing style plugin') : $row_plugin['title'];
    $options['row_plugin'] = array(
      'category' => 'style',
      'title' => t('Row style'),
      'value' => $row_title,
      'desc' => t('Change the row plugin.'),
    );

    // This adds a 'Settings' link to the row_options setting if the row style has options.
    if (!empty($row_plugin['uses options'])) {
      $options['row_plugin']['links']['row_options'] = t('Change settings for this style');
    }
  }
  if (!empty($this->definition['use ajax'])) {
    $options['use_ajax'] = array(
      'category' => 'advanced',
      'title' => t('Use AJAX'),
      'value' => $this
        ->get_option('use_ajax') ? t('Yes') : t('No'),
      'desc' => t('Change whether or not this display will use AJAX.'),
    );
  }
  if (!empty($this->definition['accept attachments'])) {
    $options['hide_attachment_summary'] = array(
      'category' => 'advanced',
      'title' => t('Hide attachments in summary'),
      'value' => $this
        ->get_option('hide_attachment_summary') ? t('Yes') : t('No'),
      'desc' => t('Change whether or not to display attachments when displaying an argument summary.'),
    );
  }
  $pager_plugin = $this
    ->get_plugin('pager');
  if (!$pager_plugin) {

    // default to the no pager plugin.
    $pager_plugin = views_get_plugin('pager', 'none');
  }
  $pager_str = $pager_plugin
    ->summary_title();
  $options['pager'] = array(
    'category' => 'basic',
    'title' => t('Use pager'),
    'value' => $pager_str,
    'desc' => t("Change this display's pager setting."),
  );

  // If pagers aren't allowed, change the text of the item:
  if (empty($this->definition['use pager'])) {
    $options['pager']['title'] = t('Items to display');
  }
  if (!empty($pager_plugin->definition['uses options'])) {
    $options['pager']['links']['pager_options'] = t('Change settings for this pager type.');
  }
  if (!empty($this->definition['use more'])) {
    $options['use_more'] = array(
      'category' => 'basic',
      'title' => t('More link'),
      'value' => $this
        ->get_option('use_more') ? t('Yes') : t('No'),
      'desc' => t('Specify whether this display will provide a "more" link.'),
    );
  }
  $this->view
    ->init_query();
  if ($this->view->query
    ->get_aggregation_info()) {
    $options['group_by'] = array(
      'category' => 'advanced',
      'title' => t('Use grouping'),
      'value' => $this
        ->get_option('group_by') ? t('Yes') : t('No'),
      'desc' => t('Allow grouping and aggregation (calculation) of fields.'),
    );
  }
  $options['query'] = array(
    'category' => 'advanced',
    'title' => t('Query settings'),
    'value' => t('Settings'),
    'desc' => t('Allow to set some advanced settings for the query plugin'),
  );
  $access_plugin = $this
    ->get_plugin('access');
  if (!$access_plugin) {

    // default to the no access control plugin.
    $access_plugin = views_get_plugin('access', 'none');
  }
  $access_str = $access_plugin
    ->summary_title();
  $options['access'] = array(
    'category' => 'basic',
    'title' => t('Access'),
    'value' => $access_str,
    'desc' => t('Specify access control type for this display.'),
  );
  if (!empty($access_plugin->definition['uses options'])) {
    $options['access']['links']['access_options'] = t('Change settings for this access type.');
  }
  $cache_plugin = $this
    ->get_plugin('cache');
  if (!$cache_plugin) {

    // default to the no cache control plugin.
    $cache_plugin = views_get_plugin('cache', 'none');
  }
  $cache_str = $cache_plugin
    ->summary_title();
  $options['cache'] = array(
    'category' => 'advanced',
    'title' => t('Caching'),
    'value' => $cache_str,
    'desc' => t('Specify caching type for this display.'),
  );
  if (!empty($cache_plugin->definition['uses options'])) {
    $options['cache']['links']['cache_options'] = t('Change settings for this caching type.');
  }
  if (!empty($access_plugin->definition['uses options'])) {
    $options['access']['links']['access_options'] = t('Change settings for this access type.');
  }
  if ($this
    ->uses_link_display()) {
    $display_id = $this
      ->get_link_display();
    $link_display = empty($this->view->display[$display_id]) ? t('None') : check_plain($this->view->display[$display_id]->display_title);
    $link_display = $this
      ->get_option('link_display') == 'custom_url' ? t('Custom URL') : $link_display;
    $options['link_display'] = array(
      'category' => 'basic',
      'title' => t('Link display'),
      'value' => $link_display,
      'desc' => t('Specify which display or custom url this display will link to.'),
    );
  }
  if ($this
    ->uses_exposed_form_in_block()) {
    $options['exposed_block'] = array(
      'category' => 'exposed',
      'title' => t('Exposed form in block'),
      'value' => $this
        ->get_option('exposed_block') ? t('Yes') : t('No'),
      'desc' => t('Allow the exposed form to appear in a block instead of the view.'),
    );
  }
  $exposed_form_plugin = $this
    ->get_plugin('exposed_form');
  if (!$exposed_form_plugin) {

    // default to the no cache control plugin.
    $exposed_form_plugin = views_get_plugin('exposed_form', 'basic');
  }
  $exposed_form_str = $exposed_form_plugin
    ->summary_title();
  $options['exposed_form'] = array(
    'category' => 'exposed',
    'title' => t('Exposed form style'),
    'value' => $exposed_form_str,
    'desc' => t('Select the kind of exposed filter to use.'),
  );
  if (!empty($exposed_form_plugin->definition['uses options'])) {
    $options['exposed_form']['links']['exposed_form_options'] = t('Exposed form settings for this exposed form style.');
  }
  $css_class = check_plain(trim($this
    ->get_option('css_class')));
  if (!$css_class) {
    $css_class = t('None');
  }
  $options['css_class'] = array(
    'category' => 'style',
    'title' => t('CSS class'),
    'value' => $css_class,
    'desc' => t('Change the CSS class name(s) that will be added to this display.'),
  );
  $options['analyze-theme'] = array(
    'category' => 'style',
    'title' => t('Theme'),
    'value' => t('Information'),
    'desc' => t('Get information on how to theme this display'),
  );
  foreach ($this->extender as $extender) {
    $extender
      ->options_summary($categories, $options);
  }
}