You are here

function views_plugin_display::options_summary in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 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 670
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['basic'] = array(
    'title' => t('Basic settings'),
  );
  $options['display_title'] = array(
    'category' => 'basic',
    'title' => t('Name'),
    'value' => check_plain($this->display->display_title),
    'desc' => t('Change the name of 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.'),
  );
  $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' => 'basic',
    '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' => 'basic',
      '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' => 'basic',
      '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['use pager'])) {
    $options['use_pager'] = array(
      'category' => 'basic',
      'title' => t('Use pager'),
      'value' => $this
        ->get_option('use_pager') ? $this
        ->get_option('use_pager') === 'mini' ? t('Mini') : t('Yes') : t('No'),
      'desc' => t("Change this display's pager setting."),
    );
  }
  $items = intval($this
    ->get_option('items_per_page'));
  $options['items_per_page'] = array(
    'category' => 'basic',
    'title' => $this
      ->use_pager() ? t('Items per page') : t('Items to display'),
    'value' => $items ? $items : t('Unlimited'),
    'desc' => t('Change how many items to display.'),
  );
  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.'),
    );
  }
  $options['distinct'] = array(
    'category' => 'basic',
    'title' => t('Distinct'),
    'value' => $this
      ->get_option('distinct') ? t('Yes') : t('No'),
    'desc' => t('Display only distinct items, without duplicates.'),
  );
  $access_plugin = $this
    ->get_access_plugin();
  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_cache_plugin();
  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' => 'basic',
    '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 ($this
    ->uses_link_display()) {

    // Only show the 'link display' if there is more than one option.
    $count = 0;
    foreach ($this->view->display as $display_id => $display) {
      if (is_object($display->handler) && $display->handler
        ->has_path()) {
        $count++;
      }
      if ($count > 1) {
        break;
      }
    }
    if ($count > 1) {
      $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);
      $options['link_display'] = array(
        'category' => 'basic',
        'title' => t('Link display'),
        'value' => $link_display,
        'desc' => t('Specify which display this display will link to.'),
      );
    }
  }
  $options['exposed_block'] = array(
    'category' => 'basic',
    '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.'),
  );
  foreach (array(
    'header' => t('Header'),
    'footer' => t('Footer'),
    'empty' => t('Empty text'),
  ) as $type => $name) {
    if (!$this
      ->get_option($type)) {
      $field = t('None');
    }
    else {

      // A lot of code to get the name of the filter format.
      $fmt_string = $this
        ->get_option($type . '_format');
      if (empty($fmt_string)) {
        $fmt_string = FILTER_FORMAT_DEFAULT;
      }
      $format_val = filter_resolve_format($fmt_string);
      $format = filter_formats($format_val);
      if ($format) {
        $field = check_plain($format->name);
      }
      else {
        $field = t('Unknown/missing format');
      }
    }
    $options[$type] = array(
      'category' => 'basic',
      'title' => $name,
      'value' => $field,
      'desc' => t("Change this display's !name.", array(
        '!name' => strtolower($name),
      )),
    );
  }
  $css_class = check_plain(trim($this
    ->get_option('css_class')));
  if (!$css_class) {
    $css_class = t('None');
  }
  $options['css_class'] = array(
    'category' => 'basic',
    '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' => 'basic',
    'title' => t('Theme'),
    'value' => t('Information'),
    'desc' => t('Get information on how to theme this display'),
  );
}