You are here

public function StylePluginBase::validateOptionsForm in Views (for Drupal 7) 8.3

Validate the options form.

Overrides PluginBase::validateOptionsForm

File

lib/Drupal/views/Plugin/views/style/StylePluginBase.php, line 332
Definition of Drupal\views\Plugin\views\style\StylePluginBase.

Class

StylePluginBase
Base class to define a style plugin handler.

Namespace

Drupal\views\Plugin\views\style

Code

public function validateOptionsForm(&$form, &$form_state) {

  // Don't run validation on style plugins without the grouping setting.
  if (isset($form_state['values']['style_options']['grouping'])) {

    // Don't save grouping if no field is specified.
    foreach ($form_state['values']['style_options']['grouping'] as $index => $grouping) {
      if (empty($grouping['field'])) {
        unset($form_state['values']['style_options']['grouping'][$index]);
      }
    }
  }
}