You are here

public function Pdf::submitOptionsForm in PDF Generator 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/display/Pdf.php \Drupal\pdf_generator\Plugin\views\display\Pdf::submitOptionsForm()

Handle any special handling on the validate form.

Overrides PathPluginBase::submitOptionsForm

File

src/Plugin/views/display/Pdf.php, line 372

Class

Pdf
The plugin that handles a feed, such as RSS or atom.

Namespace

Drupal\pdf_generator\Plugin\views\display

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  parent::submitOptionsForm($form, $form_state);
  $section = $form_state
    ->get('section');
  switch ($section) {
    case 'title':
      if ($form_state
        ->getValue('sitename_title') === 1) {
        $this
          ->setOption('sitename_title', $form_state
          ->getValue('sitename_title'));
      }
      elseif ($form_state
        ->getValue('field_title') === 1) {
        $this
          ->setOption('field_title', $form_state
          ->getValue('field_title'));
        $this
          ->setOption('select_field_title', $form_state
          ->getValue('select_field_title'));
      }
      else {
        $this
          ->setOption('sitename_title', 0);
        $this
          ->setOption('field_title', 0);
      }
      break;
    case 'displays':
      $this
        ->setOption($section, $form_state
        ->getValue($section));
      break;
    case 'inline_css':
      $this
        ->setOption('inline_css', $form_state
        ->getValue('inline_css'));
      break;
    case 'file_css':
      $this
        ->setOption('file_css', $form_state
        ->getValue('file_css'));
      break;
    case 'paper_disposition':
      $this
        ->setOption('paper_disposition', $form_state
        ->getValue('paper_disposition'));
      break;
    case 'paper_size':
      $this
        ->setOption('paper_size', $form_state
        ->getValue('paper_size'));
      break;
  }
}