function color_palette_color_value
color_palette_color_value($element, $input = FALSE, $form_state = array())
Determines the value for a palette color field.
Parameters
$element: 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.
File
- modules/color/color.module, line 313
- Allows users to change the color scheme of themes.
Code
function color_palette_color_value($element, $input = FALSE, $form_state = array()) { // If we suspect a possible cross-site request forgery attack, only accept // hexadecimal CSS color strings from user input, to avoid problems when this // value is used in the JavaScript preview. if ($input !== FALSE) { // Start with the provided value for this textfield, and validate that if // necessary, falling back on the default value. $value = form_type_textfield_value($element, $input, $form_state); if (!$value || !isset($form_state['complete form']['#token']) || color_valid_hexadecimal_string($value) || drupal_valid_token($form_state['values']['form_token'], $form_state['complete form']['#token'])) { return $value; } else { return $element['#default_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/modules!color!color.module/function/color_palette_color_value/7.x