function feeds_imagegrabber_form_validate in Feeds Image Grabber 7
Same name and namespace in other branches
- 6 feeds_imagegrabber.module \feeds_imagegrabber_form_validate()
Validates the feeds_imagegrabber form of the node.
2 string references to 'feeds_imagegrabber_form_validate'
- feeds_imagegrabber_admin in ./
feeds_imagegrabber.module - Implementation of the default settings admin form.
- feeds_imagegrabber_form_node_form_alter in ./
feeds_imagegrabber.module - Implements hook_form_BASE_FORM_ID_alter().
File
- ./
feeds_imagegrabber.module, line 63 - Grabs images for items imported using the feeds module.
Code
function feeds_imagegrabber_form_validate($form, &$form_state) {
if ($form_state['values']['feeds_imagegrabber']['enabled'] == 1) {
$id_class = $form_state['values']['feeds_imagegrabber']['id_class'];
$id_class_desc = $form_state['values']['feeds_imagegrabber']['id_class_desc'];
if ($id_class) {
if (!isset($id_class_desc) || empty($id_class_desc) || $id_class_desc == '') {
form_set_error('feeds_imagegrabber][id_class_desc', "Specify the id/class of the desired tag.");
}
if ($id_class == 1 && !preg_match('/^[a-zA-Z]+[_a-zA-Z0-9-]*$/', $id_class_desc)) {
form_set_error('feeds_imagegrabber][id_class_desc', "Only alphabets, digits, hyphens and underscores are allowed in HTML id");
}
elseif ($id_class == 2 && !preg_match('/^[a-zA-Z]+[_a-zA-Z0-9- ]*$/', $id_class_desc)) {
form_set_error('feeds_imagegrabber][id_class_desc', "Only alphabets, digits, hyphens, spaces and underscores are allowed in HTML class");
}
}
else {
form_set_value($form['feeds_imagegrabber']['id_class_desc'], '', $form_state);
}
$temp = $form_state['values']['feeds_imagegrabber']['exec_time'];
if (!is_numeric($temp) || $temp < 10 || $temp != round($temp) || $temp > 75) {
form_set_error('feeds_imagegrabber][exec_time', t('Select the correct option for FIG execution time.'));
}
}
}