function imageinfo_cache_field_widget_form_alter in Imageinfo Cache 7.3
Implements hook_field_widget_form_alter().
Capture image on upload.
File
- ./
imageinfo_cache.module, line 159 - Imageinfo Cache module.
Code
function imageinfo_cache_field_widget_form_alter(&$element, &$form_state, $context) {
// Add in a process function if widget is for images.
$image_type = imageinfo_cache_detect_image_widget($context['instance']['widget']);
if (empty($image_type)) {
return;
}
if ($image_type !== 'media module') {
$element[0]['#process'][] = 'imageinfo_cache_widget_process';
}
elseif (!empty($element['#media_options']['global']['types']) && in_array('image', $element['#media_options']['global']['types']) && isset($element['#process']) && !in_array('imageinfo_cache_widget_process', $element['#process'])) {
$element['#process'][] = 'imageinfo_cache_widget_process';
}
}