You are here

public function AdvancedRouting::optionsSummary in Views Advanced Routing 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/display_extender/AdvancedRouting.php \Drupal\views_advanced_routing\Plugin\views\display_extender\AdvancedRouting::optionsSummary()

Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::optionsSummary().

$options keys is section as used by buildOptionsForm().

Overrides DisplayExtenderPluginBase::optionsSummary

File

src/Plugin/views/display_extender/AdvancedRouting.php, line 51
Contains \Drupal\views_test_data\Plugin\views\display_extender\DisplayExtenderTest.

Class

AdvancedRouting
Advanced route editor.

Namespace

Drupal\views_advanced_routing\Plugin\views\display_extender

Code

public function optionsSummary(&$categories, &$options) {
  if (!$this->displayHandler instanceof DisplayRouterInterface) {
    return;
  }
  parent::optionsSummary($categories, $options);
  $categories['views_advanced_routing'] = [
    'title' => '',
    'column' => 'second',
    'build' => [
      // Page settings is -10, Access is -5.
      '#weight' => -6,
    ],
  ];
  $message = [];
  $route = $this->options['route'];
  if (!empty($route['defaults'])) {
    $message[] = $this
      ->t('Defaults');
  }
  if (!empty($route['requirements'])) {
    $message[] = $this
      ->t('Requirements');
  }
  if (!empty($route['options'])) {
    $message[] = $this
      ->t('Options');
  }
  $options['views_advanced_routing_route'] = [
    'category' => 'views_advanced_routing',
    'title' => $this
      ->t('Route'),
    'value' => implode(' | ', $message) ?: $this
      ->t('None'),
  ];
}