You are here

function epsacrop_dialog in EPSA Crop - Image Cropping 8.2

Same name and namespace in other branches
  1. 6.2 epsacrop.module \epsacrop_dialog()
  2. 6 epsacrop.module \epsacrop_dialog()
  3. 7.2 epsacrop.module \epsacrop_dialog()

epsacrop_dialog function.

@access public

Parameters

string $entity_name:

string $field_name:

string $bundle:

int $fid:

Return value

void

1 string reference to 'epsacrop_dialog'
epsacrop_menu in ./epsacrop.module
Implements hook_menu.

File

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

Code

function epsacrop_dialog($entity_name, $field_name, $bundle, $fid) {
  $out = '<div class="epsacrop-global">' . "\n";
  $out .= '<div class="epsacrop-image-crop">' . "\n";
  $out .= '<img id="epsacrop-target" />' . "\n";
  $out .= '</div>' . "\n";
  $out .= '<div class="epsacrop-presets-menu">' . "\n";
  $out .= '<ul class="epsacrop-presets-menu-ul">' . "\n";
  $i = 0;
  $styles = _epsacrop_load_styles_by_instance($entity_name, $field_name, $bundle);
  foreach ($styles['styles'] as $style_name) {
    $style = _epsacrop_load_style($style_name);
    $effect = _epsacrop_get_effect($style);
    $id = 'epsacrop-' . $effect['ieid'] . '-' . $effect['isid'];
    $out .= '<li class="epsacrop-presets-menu-li"><a data-bgcolor="' . $effect['data']['jcrop_settings']['bgcolor'] . '" data-bgopacity="' . $effect['data']['jcrop_settings']['bgopacity'] . '" data-aspect-ratio="' . $effect['data']['jcrop_settings']['aspect_ratio'] . '" id="' . $id . '" href="javascript:Drupal.EPSACrop.crop(\'' . $id . '\');" rel="' . $effect['data']['width'] . 'x' . $effect['data']['height'] . '"' . ($i++ == 0 ? ' class="selected"' : '') . '>' . $style['name'] . '</a></li>';
  }
  $out .= '</ul>' . "\n";
  $out .= '</div>' . "\n";
  $data = _epsacrop_get_coords_from_fid($fid);
  if (!is_string($data)) {
    $data = drupal_json_encode($data);
  }
  $out .= '<div style="display:none;"><textarea id="epsacrop-coords-data">' . $data . '</textarea></div>' . "\n";
  $out .= '<br style="clear:both;" />' . "\n";
  $out .= '</div>' . "\n";
  $GLOBALS['devel_shutdown'] = FALSE;
  echo $out;
  drupal_exit();
}