You are here

function theme_presettabs in Image javascript crop 6

Same name and namespace in other branches
  1. 5 imagecrop.module \theme_presettabs()

Theme preset tabs

Parameters

$tabs array of available presets:

fid file id:

$active_preset Current active preset:

Return value

$output html of the tabs

2 theme calls to theme_presettabs()
imagecrop_docrop in ./imagecrop.admin.inc
Callback with javascript crop.
imagecrop_showcrop in ./imagecrop.admin.inc
Show the cropped image.

File

./imagecrop.module, line 886
Provides a javascript toolbox through an imagecache action.

Code

function theme_presettabs($presets, $fid, $active_preset, $module = '', $field = '', $node_type = '') {
  $module = $module ? '/' . $module : '';
  $field = $field ? '/' . $field : '';
  $node_type = $node_type ? '/' . $node_type : '';
  $tabs[0] = array(
    'data' => t('Select a preset to crop »'),
    'class' => 'preset-label',
  );
  foreach ($presets['tabs'] as $key => $preset) {
    $key++;
    $class = '';
    if ($preset == $active_preset) {
      $tabs[$key]['class'] = 'active';
      $class = 'imagecrop_highlight';
    }
    $url = 'imagecrop/showcrop/' . $fid . '/' . $preset . $module . $field . $node_type;
    $tabs[$key] = array(
      'data' => l($preset, $url),
    );
  }
  return '<div id="imagecrop_presettabs">' . theme('item_list', $tabs, NULL, 'ul', array(
    'id' => 'preset-tabs',
  )) . '<br style="clear: both;"/></div>';
}