You are here

public function ChartsPluginDisplayChart::optionsSummary in Charts 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::optionsSummary()
  2. 8.3 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::optionsSummary()
  3. 5.0.x src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::optionsSummary()

Provide the summary for page options in the views UI.

This output is returned as an array.

Parameters

$categories:

$options:

Overrides Attachment::optionsSummary

File

src/Plugin/views/display/ChartsPluginDisplayChart.php, line 54
Contains the Chart display type (similar to Page, Block, Attachment, etc.)

Class

ChartsPluginDisplayChart
Display plugin to attach multiple chart configurations to the same chart.

Namespace

Drupal\charts\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'] = [
    'title' => t('Chart 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);
    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('Parent display'),
    'value' => $attach_to,
  );
  $options['inherit_yaxis'] = array(
    'category' => 'attachment',
    'title' => $this
      ->t('Axis settings'),
    'value' => $this
      ->getOption('inherit_yaxis') ? t('Use primary Y-axis') : t('Create secondary axis'),
  );
  $options['attachment_position'] = array(
    'disabled' => TRUE,
  );
  $options['inherit_pager'] = array(
    'disabled' => TRUE,
  );
  $options['render_pager'] = array(
    'disabled' => TRUE,
  );
}