function _simplecrop_field_widget_switch_display in SimpleCrop 7
Shows and hides several image field widgets depends on current display.
3 calls to _simplecrop_field_widget_switch_display()
- simplecrop_field_widget_change_display_submit in includes/
simplecrop.field.inc - Crop submit callback. Switches between displays and saves crop data.
- simplecrop_field_widget_process in includes/
simplecrop.field.inc - Element #process callback for the image_image field type.
- simplecrop_file_field_submit in includes/
simplecrop.field.inc - Submit callback for image upload button. We need this to save current widget display in forms cache.
File
- includes/
simplecrop.field.inc, line 770 - Contains information about field widget and related functions.
Code
function _simplecrop_field_widget_switch_display(&$element, $display) {
$crop_display = $display == SIMPLECROP_DISPLAY_CROPPED_IMAGE;
$element['cropped_image']['#access'] = $crop_display ? TRUE : FALSE;
$element['source_image']['#access'] = $crop_display ? FALSE : TRUE;
$element['data']['#access'] = $crop_display ? FALSE : TRUE;
$element['display_reload']['#value'] = $crop_display ? t('Edit crop') : t('Apply crop');
}