You are here

public function Attachment::optionsSummary in Views (for Drupal 7) 8.3

Provide the summary for attachment options in the views UI.

This output is returned as an array.

Overrides DisplayPluginBase::optionsSummary

File

lib/Drupal/views/Plugin/views/display/Attachment.php, line 75
Definition of 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' => t('Attachment settings'),
    'column' => 'second',
    'build' => array(
      '#weight' => -10,
    ),
  );
  $displays = array_filter($this
    ->getOption('displays'));
  if (count($displays) > 1) {
    $attach_to = t('Multiple displays');
  }
  elseif (count($displays) == 1) {
    $display = array_shift($displays);
    if (!empty($this->view->display[$display])) {
      $attach_to = check_plain($this->view->display[$display]['display_title']);
    }
  }
  if (!isset($attach_to)) {
    $attach_to = t('Not defined');
  }
  $options['displays'] = array(
    'category' => 'attachment',
    'title' => t('Attach to'),
    'value' => $attach_to,
  );
  $options['attachment_position'] = array(
    'category' => 'attachment',
    'title' => t('Attachment position'),
    'value' => $this
      ->attachmentPositions($this
      ->getOption('attachment_position')),
  );
  $options['inherit_arguments'] = array(
    'category' => 'attachment',
    'title' => t('Inherit contextual filters'),
    'value' => $this
      ->getOption('inherit_arguments') ? t('Yes') : t('No'),
  );
  $options['inherit_exposed_filters'] = array(
    'category' => 'attachment',
    'title' => t('Inherit exposed filters'),
    'value' => $this
      ->getOption('inherit_exposed_filters') ? t('Yes') : t('No'),
  );
  $options['inherit_pager'] = array(
    'category' => 'pager',
    'title' => t('Inherit pager'),
    'value' => $this
      ->getOption('inherit_pager') ? t('Yes') : t('No'),
  );
  $options['render_pager'] = array(
    'category' => 'pager',
    'title' => t('Render pager'),
    'value' => $this
      ->getOption('render_pager') ? t('Yes') : t('No'),
  );
}