You are here

public function ElevateZoomPlusForm::edit_form_validate in ElevateZoom Plus 7

Validate callback for the edit form.

Overrides ctools_export_ui::edit_form_validate

File

modules/ui/src/Form/ElevateZoomPlusForm.php, line 502

Class

ElevateZoomPlusForm
Extends base form for elevatezoomplus instance configuration form.

Namespace

Drupal\elevatezoomplus_ui\Form

Code

public function edit_form_validate(&$form, &$form_state) {
  parent::edit_form_validate($form, $form_state);

  // Cleanups unused/ empty settings.
  unset($form_state['values']['options']['options__active_tab']);
  if (isset($form_state['values']['options']['settings']['respond'])) {
    unset($form_state['values']['options']['settings']['respond']['actions']);
    $responds = $form_state['values']['options']['settings']['respond'];
    if ($responds) {
      foreach ($responds as $key => $respond) {
        unset($form_state['values']['options']['settings']['respond'][$key]['remove_respond']);
        if (empty($respond['range'])) {
          unset($form_state['values']['options']['settings']['respond'][$key]);
        }
      }
      $responds = $form_state['values']['options']['settings']['respond'];
      if (count($responds) > 0) {
        $form_state['values']['options']['settings']['responsive'] = 1;
      }
    }
  }
}