You are here

public function IcalDisplay::optionsSummary in Views iCal 8

Provides the default summary for options in the views UI.

This output is returned as an array.

Overrides Feed::optionsSummary

File

src/Plugin/views/display/IcalDisplay.php, line 27

Class

IcalDisplay
Provides a separate iCal display type.

Namespace

Drupal\views_ical\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
  parent::optionsSummary($categories, $options);

  // Since we're childing off the 'path' type, we'll still *call* our
  // category 'page' but let's override it so it says ICS settings.
  $categories['page'] = [
    'title' => $this
      ->t('iCal Settings'),
    'column' => 'second',
    'build' => [
      '#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);
    $displays = $this->view->storage
      ->get('display');
    if (!empty($displays[$display])) {
      $attach_to = $displays[$display]['display_title'];
    }
  }
  if (!isset($attach_to)) {
    $attach_to = $this
      ->t('None');
  }
  $options['displays'] = array(
    'category' => 'path',
    'title' => $this
      ->t('Attach to'),
    'value' => $attach_to,
  );

  // Add filename to the summary if set.
  if ($this
    ->getOption('filename')) {
    $options['path']['value'] .= $this
      ->t(' (@filename)', [
      '@filename' => $this
        ->getOption('filename'),
    ]);
  }
}