function form_type_image_button_value
form_type_image_button_value($form, $input, $form_state)
Determines the value for an image button form element.
Parameters
$form: The form element whose value is being populated.
$input: The incoming input to populate the form element. If this is FALSE, the element's default value should be returned.
$form_state: A keyed array containing the current state of the form.
Return value
The data that will appear in the $form_state['values'] collection for this element. Return nothing to use the default.
Related topics
File
- includes/form.inc, line 2299
- Functions for form and batch generation and processing.
Code
function form_type_image_button_value($form, $input, $form_state) { if ($input !== FALSE) { if (!empty($input)) { // If we're dealing with Mozilla or Opera, we're lucky. It will // return a proper value, and we can get on with things. return $form['#return_value']; } else { // Unfortunately, in IE we never get back a proper value for THIS // form element. Instead, we get back two split values: one for the // X and one for the Y coordinates on which the user clicked the // button. We'll find this element in the #post data, and search // in the same spot for its name, with '_x'. $input = $form_state['input']; foreach (explode('[', $form['#name']) as $element_name) { // chop off the ] that may exist. if (substr($element_name, -1) == ']') { $element_name = substr($element_name, 0, -1); } if (!isset($input[$element_name])) { if (isset($input[$element_name . '_x'])) { return $form['#return_value']; } return NULL; } $input = $input[$element_name]; } return $form['#return_value']; } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!form.inc/function/form_type_image_button_value/7.x