function DisplayPluginBase::optionsSummary
Same name in other branches
- 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary()
- 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary()
- 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary()
Overrides DisplayPluginInterface::optionsSummary
5 calls to DisplayPluginBase::optionsSummary()
- Attachment::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ Attachment.php - Provide the summary for attachment options in the views UI.
- Block::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ Block.php - Provide the summary for page options in the views UI.
- DisplayTest::optionsSummary in core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ display/ DisplayTest.php - Provides the default summary for options in the views UI.
- EntityReference::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ EntityReference.php - Provides the default summary for options in the views UI.
- PathPluginBase::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ PathPluginBase.php - Provides the default summary for options in the views UI.
5 methods override DisplayPluginBase::optionsSummary()
- Attachment::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ Attachment.php - Provide the summary for attachment options in the views UI.
- Block::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ Block.php - Provide the summary for page options in the views UI.
- DisplayTest::optionsSummary in core/
modules/ views/ tests/ modules/ views_test_data/ src/ Plugin/ views/ display/ DisplayTest.php - Provides the default summary for options in the views UI.
- EntityReference::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ EntityReference.php - Provides the default summary for options in the views UI.
- PathPluginBase::optionsSummary in core/
modules/ views/ src/ Plugin/ views/ display/ PathPluginBase.php - Provides the default summary for options in the views UI.
File
-
core/
modules/ views/ src/ Plugin/ views/ display/ DisplayPluginBase.php, line 1067
Class
- DisplayPluginBase
- Base class for views display plugins.
Namespace
Drupal\views\Plugin\views\displayCode
public function optionsSummary(&$categories, &$options) {
$categories = [
'title' => [
'title' => $this->t('Title'),
'column' => 'first',
],
'format' => [
'title' => $this->t('Format'),
'column' => 'first',
],
'filters' => [
'title' => $this->t('Filters'),
'column' => 'first',
],
'fields' => [
'title' => $this->t('Fields'),
'column' => 'first',
],
'pager' => [
'title' => $this->t('Pager'),
'column' => 'second',
],
'language' => [
'title' => $this->t('Language'),
'column' => 'second',
],
'exposed' => [
'title' => $this->t('Exposed form'),
'column' => 'third',
'build' => [
'#weight' => 1,
],
],
'access' => [
'title' => '',
'column' => 'second',
'build' => [
'#weight' => -5,
],
],
'other' => [
'title' => $this->t('Other'),
'column' => 'third',
'build' => [
'#weight' => 2,
],
],
];
if ($this->display['id'] != 'default') {
$options['display_id'] = [
'category' => 'other',
'title' => $this->t('Machine Name'),
'value' => !empty($this->display['new_id']) ? $this->display['new_id'] : $this->display['id'],
'desc' => $this->t('Change the machine name of this display.'),
];
}
$display_comment = Unicode::truncate($this->getOption('display_comment'), 80, TRUE, TRUE);
$options['display_comment'] = [
'category' => 'other',
'title' => $this->t('Administrative comment'),
'value' => !empty($display_comment) ? $display_comment : $this->t('None'),
'desc' => $this->t('Comment or document this display.'),
];
$title = strip_tags($this->getOption('title'));
if (!$title) {
$title = $this->t('None');
}
$options['title'] = [
'category' => 'title',
'title' => $this->t('Title'),
'value' => Unicode::truncate($title, 32, FALSE, TRUE),
'desc' => $this->t('Change the title that this display will use.'),
];
$style_plugin_instance = $this->getPlugin('style');
$style_summary = empty($style_plugin_instance->definition['title']) ? $this->t('Missing style plugin') : $style_plugin_instance->summaryTitle();
$style_title = empty($style_plugin_instance->definition['title']) ? $this->t('Missing style plugin') : $style_plugin_instance->pluginTitle();
$options['style'] = [
'category' => 'format',
'title' => $this->t('Format'),
'value' => $style_title,
'setting' => $style_summary,
'desc' => $this->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'] = $this->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']) ? $this->t('Missing row plugin') : $row_plugin_instance->summaryTitle();
$row_title = empty($row_plugin_instance->definition['title']) ? $this->t('Missing row plugin') : $row_plugin_instance->pluginTitle();
$options['row'] = [
'category' => 'format',
'title' => $this->t('Show'),
'value' => $row_title,
'setting' => $row_summary,
'desc' => $this->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'] = $this->t('Change settings for this style');
}
}
if ($this->usesAJAX()) {
$options['use_ajax'] = [
'category' => 'other',
'title' => $this->t('Use AJAX'),
'value' => $this->getOption('use_ajax') ? $this->t('Yes') : $this->t('No'),
'desc' => $this->t('Change whether or not this display will use AJAX.'),
];
}
if ($this->usesAttachments()) {
$options['hide_attachment_summary'] = [
'category' => 'other',
'title' => $this->t('Hide attachments in summary'),
'value' => $this->getOption('hide_attachment_summary') ? $this->t('Yes') : $this->t('No'),
'desc' => $this->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['show_admin_links'] = [
'category' => 'other',
'title' => $this->t('Contextual links'),
'value' => $this->getOption('show_admin_links') ? $this->t('Shown') : $this->t('Hidden'),
'desc' => $this->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::pluginManager('pager')->createInstance('none');
}
$pager_str = $pager_plugin->summaryTitle();
$options['pager'] = [
'category' => 'pager',
'title' => $this->t('Use pager'),
'value' => $pager_plugin->pluginTitle(),
'setting' => $pager_str,
'desc' => $this->t("Change this display's pager setting."),
];
// If pagers aren't allowed, change the text of the item.
if (!$this->usesPager()) {
$options['pager']['title'] = $this->t('Items to display');
}
if ($pager_plugin->usesOptions()) {
$options['pager']['links']['pager_options'] = $this->t('Change settings for this pager type.');
}
if ($this->usesMore()) {
$options['use_more'] = [
'category' => 'pager',
'title' => $this->t('More link'),
'value' => $this->getOption('use_more') ? $this->t('Yes') : $this->t('No'),
'desc' => $this->t('Specify whether this display will provide a "more" link.'),
];
}
$this->view
->initQuery();
if ($this->view->query
->getAggregationInfo()) {
$options['group_by'] = [
'category' => 'other',
'title' => $this->t('Use aggregation'),
'value' => $this->getOption('group_by') ? $this->t('Yes') : $this->t('No'),
'desc' => $this->t('Allow grouping and aggregation (calculation) of fields.'),
];
}
$options['query'] = [
'category' => 'other',
'title' => $this->t('Query settings'),
'value' => $this->t('Settings'),
'desc' => $this->t('Allow to set some advanced settings for the query plugin'),
];
if (\Drupal::languageManager()->isMultilingual() && $this->isBaseTableTranslatable()) {
$rendering_language_options = $this->buildRenderingLanguageOptions();
$options['rendering_language'] = [
'category' => 'language',
'title' => $this->t('Rendering Language'),
'value' => $rendering_language_options[$this->getOption('rendering_language')],
'desc' => $this->t('All content that supports 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::pluginManager('access')->createInstance('none');
}
$access_str = $access_plugin->summaryTitle();
$options['access'] = [
'category' => 'access',
'title' => $this->t('Access'),
'value' => $access_plugin->pluginTitle(),
'setting' => $access_str,
'desc' => $this->t('Specify access control type for this display.'),
];
if ($access_plugin->usesOptions()) {
$options['access']['links']['access_options'] = $this->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::pluginManager('cache')->createInstance('none');
}
$cache_str = $cache_plugin->summaryTitle();
$options['cache'] = [
'category' => 'other',
'title' => $this->t('Caching'),
'value' => $cache_plugin->pluginTitle(),
'setting' => $cache_str,
'desc' => $this->t('Specify caching type for this display.'),
];
if ($cache_plugin->usesOptions()) {
$options['cache']['links']['cache_options'] = $this->t('Change settings for this caching type.');
}
if ($access_plugin->usesOptions()) {
$options['access']['links']['access_options'] = $this->t('Change settings for this access type.');
}
if ($this->usesLinkDisplay()) {
$link_display_option = $this->getOption('link_display');
$link_display = $this->t('None');
if ($link_display_option == 'custom_url') {
$link_display = $this->t('Custom URL');
}
elseif (!empty($link_display_option)) {
$display_id = $this->getLinkDisplay();
$displays = $this->view->storage
->get('display');
if (!empty($displays[$display_id])) {
$link_display = $displays[$display_id]['display_title'];
}
}
$options['link_display'] = [
'category' => 'pager',
'title' => $this->t('Link display'),
'value' => $link_display,
'desc' => $this->t('Specify which display or custom URL this display will link to.'),
];
}
if ($this->usesExposedFormInBlock()) {
$options['exposed_block'] = [
'category' => 'exposed',
'title' => $this->t('Exposed form in block'),
'value' => $this->getOption('exposed_block') ? $this->t('Yes') : $this->t('No'),
'desc' => $this->t('Allow the exposed form to appear in a block instead of the view.'),
];
}
/** @var \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface $exposed_form_plugin */
$exposed_form_plugin = $this->getPlugin('exposed_form');
if (!$exposed_form_plugin) {
// Default to the no cache control plugin.
$exposed_form_plugin = Views::pluginManager('exposed_form')->createInstance('basic');
}
$exposed_form_str = $exposed_form_plugin->summaryTitle();
$options['exposed_form'] = [
'category' => 'exposed',
'title' => $this->t('Exposed form style'),
'value' => $exposed_form_plugin->pluginTitle(),
'setting' => $exposed_form_str,
'desc' => $this->t('Select the kind of exposed filter to use.'),
];
if ($exposed_form_plugin->usesOptions()) {
$options['exposed_form']['links']['exposed_form_options'] = $this->t('Exposed form settings for this exposed form style.');
}
$css_class = trim($this->getOption('css_class'));
if (!$css_class) {
$css_class = $this->t('None');
}
$options['css_class'] = [
'category' => 'other',
'title' => $this->t('CSS class'),
'value' => $css_class,
'desc' => $this->t('Change the CSS class name(s) that will be added to this display.'),
];
foreach ($this->extenders as $extender) {
$extender->optionsSummary($categories, $options);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.