function _mobile_switch_prevent_devices_strings_validate in Mobile Switch 7.2
Same name and namespace in other branches
- 6 includes/mobile_switch.admin.inc \_mobile_switch_prevent_devices_strings_validate()
- 7 includes/mobile_switch.admin.inc \_mobile_switch_prevent_devices_strings_validate()
Render API callback: Validates the user agent string parts.
Ensures that only letters and no blank lines has been entered.
This function is assigned as an #element_validate callback in mobile_switch_settings_form().
1 string reference to '_mobile_switch_prevent_devices_strings_validate'
- mobile_switch_advanced_settings_form in includes/
mobile_switch.admin.inc - Form constructor for the Advanced settings form.
File
- includes/
mobile_switch.admin.inc, line 325 - Administrative page callbacks for the Mobile Switch module.
Code
function _mobile_switch_prevent_devices_strings_validate($element, &$form_state) {
if (preg_match("/[^a-z][^\na-z]|[a-z][^\na-z]\$|.{0}\n\$/i", $element['#value'])) {
form_error($element, t('%title: Use only the described characters and no blank lines.', array(
'%title' => t($element['#title']),
)));
}
}