You are here

public function ChartsPluginDisplayChart::submitOptionsForm in Charts 5.0.x

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

Overrides Attachment::submitOptionsForm

File

src/Plugin/views/display/ChartsPluginDisplayChart.php, line 117

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;

    // @todo set isDefaulted to false by default.
    case 'inherit_arguments':
    case 'inherit_exposed_filters':
    case 'inherit_pager':
    case 'inherit_yaxis':
      $this
        ->setOption($section, $form_state
        ->getValue($section));
      break;
  }
}