function textimage_color_element_validate in Textimage 7.3
Validation callback for 'textimage_color' form element.
1 string reference to 'textimage_color_element_validate'
- textimage_element_info in ./
textimage.module - Implements hook_element_info().
File
- ./
textimage.module, line 768 - Textimage - Provides text to image manipulations.
Code
function textimage_color_element_validate(&$element, &$form_state, $form) {
// Normalize returned element values to a rgba hex value.
if ($element['#allow_transparent'] && $element['container']['transparent']['#value']) {
$element['#value'] = NULL;
}
elseif ($element['#allow_transparent'] || $element['#allow_opacity']) {
$element['#value'] = drupal_strtoupper($element['container']['hex']['#value']);
}
else {
$element['#value'] = drupal_strtoupper($element['hex']['#value']);
}
if ($element['#value'] && $element['#value'][0] != '#') {
$element['#value'] = '#' . $element['#value'];
}
if ($element['#value'] && $element['#allow_opacity']) {
$element['#value'] .= _textimage_opacity_to_alpha($element['container']['opacity']['#value']);
}
// Replace the element value in the parent form with the normalized value.
$value =& $form_state['values'];
foreach ($element['#parents'] as $path) {
$value =& $value[$path];
}
$value = $element['#value'];
}