You are here

public function ChartsPluginDisplayChart::submitOptionsForm 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::submitOptionsForm()
  2. 8.3 src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::submitOptionsForm()
  3. 5.0.x src/Plugin/views/display/ChartsPluginDisplayChart.php \Drupal\charts\Plugin\views\display\ChartsPluginDisplayChart::submitOptionsForm()

Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

Parameters

$form:

FormStateInterface $form_state:

Overrides Attachment::submitOptionsForm

File

src/Plugin/views/display/ChartsPluginDisplayChart.php, line 134
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 submitOptionsForm(&$form, FormStateInterface $form_state) {

  // It is very important to call the parent function here:
  parent::submitOptionsForm($form, $form_state);
  $section = $form_state
    ->get('section');
  switch ($section) {
    case 'displays':
      $form_state
        ->setValue($section, array_filter($form_state
        ->getValue($section)));
      break;
    case 'inherit_arguments':
    case 'inherit_exposed_filters':
    case 'inherit_yaxis':
      $this
        ->setOption($section, $form_state
        ->getValue($section));
      break;
  }
}