function site_banner_validate_text_color_code_form in Site Banner 7
Validate text color submissions in form content.
Parameters
array $form_state: the form_sate object containing user settings
2 calls to site_banner_validate_text_color_code_form()
- SiteBannerContextReactionChangeBannerTextColor::options_form_validate in ./
site_banner_context_reaction_functions.inc - Validate hook for context-specific site banner text color settings.
- site_banner_admin_settings_form_validate in ./
site_banner.admin.inc - Implements hook_form_FORM_ID_validate() for node_type_form().
File
- ./
site_banner.admin.inc, line 341
Code
function site_banner_validate_text_color_code_form($form_state) {
$is_custom_text_color = $form_state['values']['site_banner_text_color_select'];
$text_color_code_as_text = $form_state['values']['site_banner_text_custom_color_form'];
// Test that if custom color is selected, then a valid color is entered.
if ($is_custom_text_color) {
if (preg_match(site_banner_get_html_color_regex_pattern(), $text_color_code_as_text) != 1) {
form_set_error('site_banner_text_custom_color_form', t('Please enter a valid hexadecimal color code for the text color (for example #ff00ff) or select an existing color.'));
}
}
}