You are here

function finder_select_element_validate in Finder 7.2

Validation callback for text element.

1 string reference to 'finder_select_element_validate'
finder_select_element in plugins/element_handler/select.inc
Element callback.

File

plugins/element_handler/select.inc, line 150
The finder select element handler plugin.

Code

function finder_select_element_validate($form_element, &$form_state) {
  $finder = $form_state['finder'];
  foreach ($finder->elements as $key => $element) {
    if ($finder
      ->esetting($element, 'multiple')) {

      // remove values in the array that are empty or 0
      foreach ($form_state['values'][$element->id] as $k => $v) {
        if (!$v) {
          unset($form_state['values'][$element->id][$k]);
        }
      }

      // append an 'empty string' choice if we just wiped the whole array and we need a value for the url args
      if ($finder
        ->setting('url') && empty($form_state['values'][$element->id])) {
        $form_state['values'][$element->id][] = '';
      }
    }
  }
}