You are here

function theme_epsacrop_widget_item in EPSA Crop - Image Cropping 6

Same name and namespace in other branches
  1. 6.2 epsacrop.module \theme_epsacrop_widget_item()

fonction theme qui ajouter le lien gérer le crop

1 string reference to 'theme_epsacrop_widget_item'
epsacrop_theme in ./epsacrop.module
Implementation of hook_theme permet d'overider la fonction de imagefield afin d'ajouter le lien pour gérer le crop

File

./epsacrop.module, line 412
The main file of module

Code

function theme_epsacrop_widget_item($element) {
  $type_name = $element['#type_name'];
  $field_name = $element['#field_name'];
  if ((int) $element['fid']['#value'] > 0 && count(_epsacrop_get_field_actions($type_name, $field_name))) {
    $fid = (int) $element['fid']['#value'];
    $filepath = _epsacrop_get_path_from_fid($fid);
    if (!empty($filepath)) {
      global $base_root;
      $info = @getimagesize('./' . $filepath);
      $filepath = _epsacrop_thumb_filepath($filepath);
      $element['epsacrop'] = array(
        '#type' => 'markup',
        '#value' => '[<a rel="nozoom" class="modalframe-exclude" href="javascript:Drupal.EPSACrop.dialog(\'' . $type_name . '\', \'' . $field_name . '\', \'' . $element['fid']['#value'] . '\', \'' . $base_root . base_path() . addslashes($filepath) . '\', [' . $info[0] . ', ' . $info[1] . ']);">' . t("Manage image crops") . '</a>]',
      );
    }
  }
  return theme('filefield_widget_item', $element);
}