You are here

function cck_select_other_handler_filter::exposed_submit in CCK Select Other 7.2

Same name and namespace in other branches
  1. 7 views/cck_select_other_handler_filter.inc \cck_select_other_handler_filter::exposed_submit()

Submit the exposed handler form.

Overrides views_handler::exposed_submit

File

views/cck_select_other_handler_filter.inc, line 65

Class

cck_select_other_handler_filter
Extends Views in operator filter.

Code

function exposed_submit(&$form, &$form_state) {
  $identifier = $this->options['expose']['identifier'];
  $values = $form_state['values']['options'][$identifier];
  $form_state['values'][$identifier] = array();
  if (is_array($values['select_other_list'])) {

    // Multiple values will be stored in an array.
    foreach ($values['select_other_list'] as $key => $value) {
      if ($value && $key == $value) {
        if ($value != 'other') {
          $form_state['values'][$identifier][] = $value;
        }
        else {

          // Set the other value instead of 'other'
          $form_state['values'][$identifier][] = $values['select_other_text_input'];
        }
      }
    }
  }
  else {
    if ($values['select_other_list'] == 'other') {
      $form_state['values'][$identifier] = $values['select_other_text_input'];
    }
    else {
      $form_state['values'][$identifier] = $values['select_other_list'];
    }
  }
}