public function DisplayPluginBase::optionsSummary

Provide the default summary for options in the views UI.

This output is returned as an array.

4 calls to DisplayPluginBase::optionsSummary()
Attachment::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
Provide the summary for attachment options in the views UI.
Block::optionsSummary in drupal/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php
Provide the summary for page options in the views UI.
DisplayTest::optionsSummary in drupal/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/display/DisplayTest.php
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummaryv().
PathPluginBase::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php
Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().
4 methods override DisplayPluginBase::optionsSummary()
Attachment::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
Provide the summary for attachment options in the views UI.
Block::optionsSummary in drupal/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php
Provide the summary for page options in the views UI.
DisplayTest::optionsSummary in drupal/core/modules/views/tests/views_test_data/lib/Drupal/views_test_data/Plugin/views/display/DisplayTest.php
Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummaryv().
PathPluginBase::optionsSummary in drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/PathPluginBase.php
Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php, line 993
Contains Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

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

Namespace

Drupal\views\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
  $categories = array(
    'title' => array(
      'title' => t('Title'),
      'column' => 'first',
    ),
    'format' => array(
      'title' => t('Format'),
      'column' => 'first',
    ),
    'filters' => array(
      'title' => t('Filters'),
      'column' => 'first',
    ),
    'fields' => array(
      'title' => t('Fields'),
      'column' => 'first',
    ),
    'pager' => array(
      'title' => t('Pager'),
      'column' => 'second',
    ),
    'exposed' => array(
      'title' => t('Exposed form'),
      'column' => 'third',
      'build' => array(
        '#weight' => 1,
      ),
    ),
    'access' => array(
      'title' => '',
      'column' => 'second',
      'build' => array(
        '#weight' => -5,
      ),
    ),
    'other' => array(
      'title' => t('Other'),
      'column' => 'third',
      'build' => array(
        '#weight' => 2,
      ),
    ),
  );
  if ($this->display['id'] != 'default') {
    $options['display_id'] = array(
      'category' => 'other',
      '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.'),
    );
  }
  $display_comment = check_plain(drupal_substr($this
    ->getOption('display_comment'), 0, 10));
  $options['display_comment'] = array(
    'category' => 'other',
    'title' => t('Comment'),
    'value' => !empty($display_comment) ? $display_comment : t('No comment'),
    'desc' => t('Comment or document this display.'),
  );
  $title = strip_tags($this
    ->getOption('title'));
  if (!$title) {
    $title = t('None');
  }
  $options['title'] = array(
    'category' => 'title',
    'title' => t('Title'),
    'value' => $title,
    'desc' => t('Change the title that this display will use.'),
  );
  $style_plugin_instance = $this
    ->getPlugin('style');
  $style_summary = empty($style_plugin_instance->definition['title']) ? t('Missing style plugin') : $style_plugin_instance
    ->summaryTitle();
  $style_title = empty($style_plugin_instance->definition['title']) ? t('Missing style plugin') : $style_plugin_instance
    ->pluginTitle();
  $style = '';
  $options['style'] = array(
    'category' => 'format',
    'title' => t('Format'),
    'value' => $style_title,
    'setting' => $style_summary,
    'desc' => t('Change the way content is formatted.'),
  );

  // This adds a 'Settings' link to the style_options setting if the style has options.
  if ($style_plugin_instance
    ->usesOptions()) {
    $options['style']['links']['style_options'] = t('Change settings for this format');
  }
  if ($style_plugin_instance
    ->usesRowPlugin()) {
    $row_plugin_instance = $this
      ->getPlugin('row');
    $row_summary = empty($row_plugin_instance->definition['title']) ? t('Missing style plugin') : $row_plugin_instance
      ->summaryTitle();
    $row_title = empty($row_plugin_instance->definition['title']) ? t('Missing style plugin') : $row_plugin_instance
      ->pluginTitle();
    $options['row'] = array(
      'category' => 'format',
      'title' => t('Show'),
      'value' => $row_title,
      'setting' => $row_summary,
      'desc' => t('Change the way each row in the view is styled.'),
    );

    // This adds a 'Settings' link to the row_options setting if the row style has options.
    if ($row_plugin_instance
      ->usesOptions()) {
      $options['row']['links']['row_options'] = t('Change settings for this style');
    }
  }
  if ($this
    ->usesAJAX()) {
    $options['use_ajax'] = array(
      'category' => 'other',
      'title' => t('Use AJAX'),
      'value' => $this
        ->getOption('use_ajax') ? t('Yes') : t('No'),
      'desc' => t('Change whether or not this display will use AJAX.'),
    );
  }
  if ($this
    ->usesAttachments()) {
    $options['hide_attachment_summary'] = array(
      'category' => 'other',
      'title' => t('Hide attachments in summary'),
      'value' => $this
        ->getOption('hide_attachment_summary') ? t('Yes') : t('No'),
      'desc' => t('Change whether or not to display attachments when displaying a contextual filter summary.'),
    );
  }
  if (!isset($this->definition['contextual links locations']) || !empty($this->definition['contextual links locations'])) {
    $options['hide_admin_links'] = array(
      'category' => 'other',
      'title' => t('Hide contextual links'),
      'value' => $this
        ->getOption('hide_admin_links') ? t('Yes') : t('No'),
      'desc' => t('Change whether or not to display contextual links for this view.'),
    );
  }
  $pager_plugin = $this
    ->getPlugin('pager');
  if (!$pager_plugin) {

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

  // If pagers aren't allowed, change the text of the item:
  if (!$this
    ->usesPager()) {
    $options['pager']['title'] = t('Items to display');
  }
  if ($pager_plugin
    ->usesOptions()) {
    $options['pager']['links']['pager_options'] = t('Change settings for this pager type.');
  }
  if ($this
    ->usesMore()) {
    $options['use_more'] = array(
      'category' => 'pager',
      'title' => t('More link'),
      'value' => $this
        ->getOption('use_more') ? t('Yes') : t('No'),
      'desc' => t('Specify whether this display will provide a "more" link.'),
    );
  }
  $this->view
    ->initQuery();
  if ($this->view->query
    ->get_aggregation_info()) {
    $options['group_by'] = array(
      'category' => 'other',
      'title' => t('Use aggregation'),
      'value' => $this
        ->getOption('group_by') ? t('Yes') : t('No'),
      'desc' => t('Allow grouping and aggregation (calculation) of fields.'),
    );
  }
  $options['query'] = array(
    'category' => 'other',
    'title' => t('Query settings'),
    'value' => t('Settings'),
    'desc' => t('Allow to set some advanced settings for the query plugin'),
  );
  $languages = array(
    '***CURRENT_LANGUAGE***' => t("Current user's language"),
    '***DEFAULT_LANGUAGE***' => t("Default site language"),
    LANGUAGE_NOT_SPECIFIED => t('Language neutral'),
  );
  if (module_exists('language')) {
    $languages = array_merge($languages, language_list());
  }
  $options['field_langcode'] = array(
    'category' => 'other',
    'title' => t('Field Language'),
    'value' => $languages[$this
      ->getOption('field_langcode')],
    'desc' => t('All fields which support translations will be displayed in the selected language.'),
  );
  $access_plugin = $this
    ->getPlugin('access');
  if (!$access_plugin) {

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

    // default to the no cache control plugin.
    $cache_plugin = views_get_plugin('cache', 'none');
  }
  $cache_str = $cache_plugin
    ->summaryTitle();
  $options['cache'] = array(
    'category' => 'other',
    'title' => t('Caching'),
    'value' => $cache_plugin
      ->pluginTitle(),
    'setting' => $cache_str,
    'desc' => t('Specify caching type for this display.'),
  );
  if ($cache_plugin
    ->usesOptions()) {
    $options['cache']['links']['cache_options'] = t('Change settings for this caching type.');
  }
  if ($access_plugin
    ->usesOptions()) {
    $options['access']['links']['access_options'] = t('Change settings for this access type.');
  }
  if ($this
    ->usesLinkDisplay()) {
    $display_id = $this
      ->getLinkDisplay();
    $link_display = empty($this->view->display[$display_id]) ? t('None') : check_plain($this->view->display[$display_id]['display_title']);
    $link_display = $this
      ->getOption('link_display') == 'custom_url' ? t('Custom URL') : $link_display;
    $options['link_display'] = array(
      'category' => 'other',
      'title' => t('Link display'),
      'value' => $link_display,
      'desc' => t('Specify which display or custom url this display will link to.'),
    );
  }
  if ($this
    ->usesExposedFormInBlock()) {
    $options['exposed_block'] = array(
      'category' => 'exposed',
      'title' => t('Exposed form in block'),
      'value' => $this
        ->getOption('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
    ->getPlugin('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
    ->summaryTitle();
  $options['exposed_form'] = array(
    'category' => 'exposed',
    'title' => t('Exposed form style'),
    'value' => $exposed_form_plugin
      ->pluginTitle(),
    'setting' => $exposed_form_str,
    'desc' => t('Select the kind of exposed filter to use.'),
  );
  if ($exposed_form_plugin
    ->usesOptions()) {
    $options['exposed_form']['links']['exposed_form_options'] = t('Exposed form settings for this exposed form style.');
  }
  $css_class = check_plain(trim($this
    ->getOption('css_class')));
  if (!$css_class) {
    $css_class = t('None');
  }
  $options['css_class'] = array(
    'category' => 'other',
    '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' => 'other',
    'title' => t('Theme'),
    'value' => t('Information'),
    'desc' => t('Get information on how to theme this display'),
  );
  foreach ($this->extender as $extender) {
    $extender
      ->optionsSummary($categories, $options);
  }
}