You are here

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

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

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

Overrides DisplayPluginBase::optionsSummary

File

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

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'] = array(
    'title' => $this
      ->t('Entity content settings'),
    'column' => 'second',
    'build' => array(
      '#weight' => -10,
    ),
  );
  if ($entity_type = $this
    ->getOption('entity_type')) {
    $entity_info = \Drupal::entityManager()
      ->getDefinition($entity_type);
    $type_name = $entity_info
      ->get('label');
    $bundle_names = array();
    $bundle_info = \Drupal::entityManager()
      ->getBundleInfo($entity_type);
    foreach ($this
      ->getOption('bundles') as $bundle) {
      $bundle_names[] = $bundle_info[$bundle]['label'];
    }
  }
  $options['entity_type'] = array(
    'category' => 'entity_view',
    'title' => $this
      ->t('Entity type'),
    'value' => empty($type_name) ? $this
      ->t('None') : $type_name,
  );
  $options['bundles'] = array(
    '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'] = array(
    'category' => 'entity_view',
    'title' => $this
      ->t('Arguments'),
    'value' => empty($argument_mode) ? $this
      ->t('None') : SafeMarkup::checkPlain($argument_mode),
  );
  $options['show_title'] = array(
    'category' => 'entity_view',
    'title' => $this
      ->t('Show title'),
    'value' => $this
      ->getOption('show_title') ? $this
      ->t('Yes') : $this
      ->t('No'),
  );
}