You are here

public function Attachment::optionsSummary in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/display/Attachment.php \Drupal\views\Plugin\views\display\Attachment::optionsSummary()

Provide the summary for attachment options in the views UI.

This output is returned as an array.

Overrides DisplayPluginBase::optionsSummary

File

core/modules/views/src/Plugin/views/display/Attachment.php, line 75
Contains \Drupal\views\Plugin\views\display\Attachment.

Class

Attachment
The plugin that handles an attachment display.

Namespace

Drupal\views\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {

  // It is very important to call the parent function here:
  parent::optionsSummary($categories, $options);
  $categories['attachment'] = array(
    'title' => $this
      ->t('Attachment settings'),
    'column' => 'second',
    'build' => array(
      '#weight' => -10,
    ),
  );
  $displays = array_filter($this
    ->getOption('displays'));
  if (count($displays) > 1) {
    $attach_to = $this
      ->t('Multiple displays');
  }
  elseif (count($displays) == 1) {
    $display = array_shift($displays);
    if ($display = $this->view->storage
      ->getDisplay($display)) {
      $attach_to = $display['display_title'];
    }
  }
  if (!isset($attach_to)) {
    $attach_to = $this
      ->t('Not defined');
  }
  $options['displays'] = array(
    'category' => 'attachment',
    'title' => $this
      ->t('Attach to'),
    'value' => $attach_to,
  );
  $options['attachment_position'] = array(
    'category' => 'attachment',
    'title' => $this
      ->t('Attachment position'),
    'value' => $this
      ->attachmentPositions($this
      ->getOption('attachment_position')),
  );
  $options['inherit_arguments'] = array(
    'category' => 'attachment',
    'title' => $this
      ->t('Inherit contextual filters'),
    'value' => $this
      ->getOption('inherit_arguments') ? $this
      ->t('Yes') : $this
      ->t('No'),
  );
  $options['inherit_exposed_filters'] = array(
    'category' => 'attachment',
    'title' => $this
      ->t('Inherit exposed filters'),
    'value' => $this
      ->getOption('inherit_exposed_filters') ? $this
      ->t('Yes') : $this
      ->t('No'),
  );
  $options['inherit_pager'] = array(
    'category' => 'pager',
    'title' => $this
      ->t('Inherit pager'),
    'value' => $this
      ->getOption('inherit_pager') ? $this
      ->t('Yes') : $this
      ->t('No'),
  );
  $options['render_pager'] = array(
    'category' => 'pager',
    'title' => $this
      ->t('Render pager'),
    'value' => $this
      ->getOption('render_pager') ? $this
      ->t('Yes') : $this
      ->t('No'),
  );
}