function imagecrop_linkitem in Image javascript crop 6
Same name and namespace in other branches
- 5 imagecrop.module \imagecrop_linkitem()
- 7 imagecrop.module \imagecrop_linkitem()
Helper function to add click link
Return value
$form form markup
2 calls to imagecrop_linkitem()
- imagecrop_form_alter in ./
imagecrop.module - Implementation of hook_form_alter(). Hook into several existing image modules/fields.
- imagecrop_process_cck_field in ./
imagecrop.module - Process function for imagecrop-enabled cck fields.
File
- ./
imagecrop.module, line 433 - Provides a javascript toolbox through an imagecache action.
Code
function imagecrop_linkitem($fid, $module = '', $element = '') {
$popup_link_function = variable_get('imagecrop_popup', 'basic');
$width = variable_get('imagecrop_popup_width', 700);
$height = variable_get('imagecrop_popup_height', 600);
$module = $module ? '/0/' . $module : '';
$field = $element['#field_name'] ? '/' . $element['#field_name'] : '';
$node_type = $element['#type_name'] ? '/' . $element['#type_name'] : '';
$url = url('imagecrop/showcrop/' . $fid . $module . $field . $node_type, array(
'absolute' => TRUE,
));
if ($popup_link_function != 'basic' && function_exists($popup_link_function) && ($link = $popup_link_function($url, $width, $height))) {
return $link;
}
else {
return '[<a href="javascript:;" onclick="window.open(\'' . $url . '\',\'imagecrop\',\'menubar=0,scrollbars=1,resizable=1,width=' . $width . ',height=' . $height . '\');">' . t('Crop this image') . '</a>]';
}
}