You are here

function _form_type_country_value in Countries 7.2

Same name and namespace in other branches
  1. 8 countries.elements.inc \_form_type_country_value()

Helper function to determine the value for a country form element.

Parameters

array $element: The form element whose value is being populated.

bool|string|array $input: The incoming input to populate the form element. If this is FALSE, the element's default value should be returned.

Return value

array|string The data that will appear in the $element_state['values'] collection for this element. Return nothing to use the default.

1 call to _form_type_country_value()
form_type_country_value in ./countries.module
Helper function to determine the value for a country form element.

File

./countries.elements.inc, line 54
Defines all element related code for the countries module.

Code

function _form_type_country_value($element, $input = FALSE) {
  if ($input !== FALSE) {
    if (isset($element['#multiple']) && $element['#multiple']) {
      return is_array($input) ? array_values($input) : array();
    }
    else {
      return $input;
    }
  }
}