You are here

public function Page::optionsSummary in Views PDF 8

Provides the default summary for options in the views UI.

This output is returned as an array.

Overrides Page::optionsSummary

File

src/Plugin/views/display/Page.php, line 111
Contains \Drupal\views_pdf\Plugin\views\display\Page.

Class

Page
This class contains all the functionality of the PDF display.

Namespace

Drupal\views_pdf\Plugin\views\display

Code

public function optionsSummary(&$categories, &$options) {
  parent::optionsSummary($categories, $options);
  $fonts = ViewsPdfBase::getAvailableFontsCleanList();

  // Change Page title:
  $categories['page'] = [
    'title' => t('PDF settings'),
    'column' => 'second',
    'build' => [
      '#weight' => -10,
    ],
  ];

  // Add for pdf page settings
  $options['pdf_page'] = [
    'category' => 'page',
    'title' => t('PDF Page Settings'),
    'value' => $this
      ->getOption('default_page_format'),
    'desc' => t('Define some PDF specific settings.'),
  ];

  // Add for pdf font settings
  $options['pdf_fonts'] = [
    'category' => 'page',
    'title' => t('PDF Fonts Settings'),
    'value' => t(':family at :size pt', [
      ':family' => $fonts[$this
        ->getOption('default_font_family')],
      ':size' => $this
        ->getOption('default_font_size'),
    ]),
    'desc' => t('Define some PDF specific settings.'),
  ];

  // add for pdf template settings
  if ($this
    ->getOption('leading_template') !== '' || $this
    ->getOption('template') !== '' || $this
    ->getOption('succeed_template') !== '') {
    $isAnyTemplate = t('Yes');
  }
  else {
    $isAnyTemplate = t('No');
  }
  $options['pdf_template'] = [
    'category' => 'page',
    'title' => t('PDF Template Settings'),
    'value' => $isAnyTemplate,
    'desc' => t('Define some PDF specific settings.'),
  ];
  if ($this
    ->getOption('css_file') === '') {
    $css_file = t('None');
  }
  else {
    $css_file = $this
      ->getOption('css_file');
  }
  $options['css'] = [
    'category' => 'page',
    'title' => t('CSS File'),
    'value' => $css_file,
    'desc' => t('Define a CSS file attached to all HTML output.'),
  ];
}