You are here

public function Eva::optionsSummary in EVA: Entity Views Attachment 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/views/display/Eva.php \Drupal\eva\Plugin\views\display\Eva::optionsSummary()

Provides the default summary for options in the views UI.

This output is returned as an array.

Overrides DisplayPluginBase::optionsSummary

File

src/Plugin/views/display/Eva.php, line 114

Class

Eva
The plugin that handles an EVA display in views.

Namespace

Drupal\eva\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
  parent::optionsSummary($categories, $options);
  $categories['entity_view'] = [
    'title' => $this
      ->t('Entity content settings'),
    'column' => 'second',
    'build' => [
      '#weight' => -10,
    ],
  ];
  if ($entity_type = $this
    ->getOption('entity_type')) {
    $entity_info = $this->entityTypeManager
      ->getDefinition($entity_type);
    $type_name = $entity_info
      ->get('label');
    $bundle_names = [];
    $bundle_info = $this->bundleInfo
      ->getBundleInfo($entity_type);
    foreach ($this
      ->getOption('bundles') as $bundle) {
      $bundle_names[] = $bundle_info[$bundle]['label'];
    }
  }
  $options['entity_type'] = [
    'category' => 'entity_view',
    'title' => $this
      ->t('Entity type'),
    'value' => empty($type_name) ? $this
      ->t('None') : $type_name,
  ];
  $options['bundles'] = [
    'category' => 'entity_view',
    'title' => $this
      ->t('Bundles'),
    'value' => empty($bundle_names) ? $this
      ->t('All') : implode(', ', $bundle_names),
  ];
  $argument_mode = $this
    ->getOption('argument_mode');
  $options['arguments'] = [
    'category' => 'entity_view',
    'title' => $this
      ->t('Arguments'),
    'value' => empty($argument_mode) ? $this
      ->t('None') : Html::escape($argument_mode),
  ];
  $options['show_title'] = [
    'category' => 'entity_view',
    'title' => $this
      ->t('Show title'),
    'value' => $this
      ->getOption('show_title') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ];
}