You are here

function manualcrop_form_file_entity_edit_alter in Manual Crop 7

Implements hook_form_FORM_ID_alter().

Provides integration with the File Entity (and Media) module by adding the crop functionality to the file edit form.

File

./manualcrop.module, line 1023

Code

function manualcrop_form_file_entity_edit_alter(&$form, &$form_state) {
  if (isset($form['#entity']) && $form['#entity']->type == 'image' && user_access('use manualcrop')) {

    // Try to parse the GET parameter if's missing.
    if (!isset($_GET['manualcrop']) && strpos($_GET['q'], '?') !== FALSE) {
      parse_str('q=' . str_replace('?', '&', $_GET['q']), $_GET);
    }

    // Process the form.
    _manualcrop_process_file_entity_form($form, $form_state, isset($_GET['manualcrop']) ? $_GET['manualcrop'] : array());
  }
}