You are here

public function ExcelExport::submitOptionsForm in Excel Serialization 8

Same name in this branch
  1. 8 src/Plugin/views/display/ExcelExport.php \Drupal\xls_serialization\Plugin\views\display\ExcelExport::submitOptionsForm()
  2. 8 src/Plugin/views/style/ExcelExport.php \Drupal\xls_serialization\Plugin\views\style\ExcelExport::submitOptionsForm()

Handle any special handling on the validate form.

Overrides RestExport::submitOptionsForm

File

src/Plugin/views/display/ExcelExport.php, line 350

Class

ExcelExport
Provides an Excel export display plugin.

Namespace

Drupal\xls_serialization\Plugin\views\display

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  parent::submitOptionsForm($form, $form_state);
  $section = $form_state
    ->get('section');
  switch ($section) {
    case 'path':
      $this
        ->setOption('filename', $form_state
        ->getValue('filename'));
      break;
    case 'format_header':
      $this
        ->setOption('header_bold', $form_state
        ->getValue('header_bold'));
      $this
        ->setOption('header_italic', $form_state
        ->getValue('header_italic'));
      $this
        ->setOption('header_background_color', $form_state
        ->getValue('header_background_color'));
      break;
  }
  for ($i = 0; $i <= 4; $i++) {
    if ($section === 'excel_conditional_formatting_rules_' . $i) {
      $this
        ->setOption('conditional_formatting_base_field_' . $i, $form_state
        ->getValue('conditional_formatting_base_field_' . $i));
      $this
        ->setOption('conditional_formatting_operator_' . $i, $form_state
        ->getValue('conditional_formatting_operator_' . $i));
      $this
        ->setOption('conditional_formatting_compare_to_' . $i, $form_state
        ->getValue('conditional_formatting_compare_to_' . $i));
      $this
        ->setOption('conditional_formatting_background_color_' . $i, $form_state
        ->getValue('conditional_formatting_background_color_' . $i));
    }
  }
}