You are here

function select_2_hidden_value_callback in Select 2 7

Is value hidden.

2 string references to 'select_2_hidden_value_callback'
select2_element_info in ./select2.module
Implements hook_element_info().
select2_field_widget_form_alter in ./select2.module
Implements hook_field_widget_form_alter().

File

./select2.module, line 1029
Main file for Select2 module.

Code

function select_2_hidden_value_callback($element, $input = FALSE, $form_state = array()) {
  if ($input === FALSE) {
    $value = isset($element['#default_value']) ? $element['#default_value'] : 0;
    $result = is_string($value) ? explode(isset($element['#select2']['separator']) ? $element['#select2']['separator'] : SELECT2_VALUES_SEPARATOR, $value) : $value;
  }
  else {
    $result = is_string($input) ? explode(isset($element['#select2']['separator']) ? $element['#select2']['separator'] : SELECT2_VALUES_SEPARATOR, $input) : $input;
  }
  return $result;
}