function imagefield_crop_preset_delete in Imagefield Crop 7.3
Menu callback -- ask for confirmation of presset deletion
1 string reference to 'imagefield_crop_preset_delete'
- imagefield_crop_menu in ./
imagefield_crop.module - Implements hook_menu().
File
- ./
imagefield_crop.module, line 1289
Code
function imagefield_crop_preset_delete($preset) {
$presets_used = array();
foreach (field_info_instances() as $entity) {
foreach ($entity as $fields) {
foreach ($fields as $field_name => $instance) {
if ($instance['widget']['module'] == 'imagefield_crop') {
$presets_used += array_fill_keys(array_keys($instance['widget']['settings']['presets']), $instance['field_name']);
}
}
}
}
if (in_array($preset->pid, array_keys($presets_used))) {
drupal_set_message(t('Preset is used in field !field_name. ' . l('Back to preset list', 'admin/config/media/imagefield-crop-preset-list'), array(
'!field_name' => $presets_used[$preset->pid],
)));
return array();
}
else {
return drupal_get_form('imagefield_crop_preset_delete_confirm', $preset);
}
}