function imceimage_field in Imce CCK Image 6
Same name and namespace in other branches
- 6.2 imceimage.module \imceimage_field()
hook_field() implementation
File
- ./
imceimage.module, line 88
Code
function imceimage_field($op, &$node, $field, &$items, $teaser, $page) {
switch ($op) {
case 'validate':
if (is_array($items)) {
foreach ($items as $delta => $item) {
$error_field = $field['field_name'] . '][' . $delta . '][value';
if ($item['imceimage_path'] != '') {
//check the file for a valid image..
$file_path = _imceimage_image_to_filepath($item['imceimage_path']);
if (image_get_info($file_path) == FALSE) {
form_set_error($error_field, t('%name is not a valid image or has been deleted (url: %url)', array(
'%name' => t($field['widget']['label']),
'%file' => $file_path,
'%url' => $item['imceimage_path'],
)));
}
}
}
}
break;
}
}