You are here

function _manualcrop_js_identifier in Manual Crop 7

Get the unique javascript crop settings identifier.

Parameters

$data: Field instance array (preferred) or file object.

Return value

Unique javascript crop settings identifier.

1 call to _manualcrop_js_identifier()
manualcrop_croptool_process in ./manualcrop.helpers.inc
Add a croptool to the form element. This extends the FAPI widget or simply adds a new form item to enable cropping in a regular form.

File

./manualcrop.helpers.inc, line 289
Helper functions for the Manual Crop module.

Code

function _manualcrop_js_identifier($data) {
  if (is_array($data) && !empty($data['field_name'])) {
    return drupal_clean_css_identifier($data['field_name']);
  }
  elseif (is_object($data) && isset($data->fid)) {
    return 'manualcrop-file-' . $data->fid;
  }
  else {
    return 'manualcrop-' . md5(serialize($data));
  }
}