function simplecrop_form_image_style_form_alter in SimpleCrop 7
Implements hook_form_FORM_ID_alter().
File
- ./
simplecrop.module, line 114 - Contains main hook definitions for SimpleCrop module.
Code
function simplecrop_form_image_style_form_alter(&$form, &$form_state) {
// Search for already added simplecrop effect.
$style = $form_state['image_style'];
if (!empty($style['effects'])) {
foreach ($style['effects'] as $effect) {
if ($effect['module'] == 'simplecrop') {
$simplecrop_effect_exists = TRUE;
}
}
}
// If SimpleCrop effect already added, then hide possibility to add it again
// to prevent some possible issues with cropping.
if (!empty($simplecrop_effect_exists)) {
unset($form['effects']['new']['new']['#options']['simplecrop']);
}
// Submit handler for image effect form.
// Forces simplecrop effect to be the first in list.
$submit_callback = 'simplecrop_image_style_form_force_order';
$form['#submit'][] = $submit_callback;
$form['effects']['new']['add']['#submit'][] = $submit_callback;
}