function tablefield_field_validate in TableField 7.2
Same name and namespace in other branches
- 7.3 tablefield.module \tablefield_field_validate()
- 7 tablefield.module \tablefield_field_validate()
Implements hook_field_validate().
File
- ./
tablefield.module, line 325 - Provides a set of fields that can be used to store tabular data with a node.
Code
function tablefield_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
// Catch empty form submissions for required tablefields.
if ($instance['required'] && isset($items[0]) && tablefield_field_is_empty($items[0], $field)) {
$message = t('@field is a required field.', array(
'@field' => $instance['label'],
));
$errors[$field['field_name']][$langcode][0]['tablefield'][] = array(
'error' => 'empty_required_tablefield',
'message' => $message,
);
}
}