You are here

function imagecrop_formitem in Image javascript crop 5

Helper function to add form item

Return value

$form form markup

1 call to imagecrop_formitem()
imagecrop_form_alter in ./imagecrop.module
Implementation of hook_form_alter(). Hook into several existing image modules/fields.

File

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

Code

function imagecrop_formitem($fid, $weight = 0) {
  if (!module_exists('thickbox')) {
    $form = array(
      '#type' => 'item',
      '#value' => '<a href="javascript:;" onclick="window.open(\'' . url('imagecrop/showcrop/' . $fid, NULL, NULL, TRUE) . '\',\'imagecrop\',\'menubar=0,resizable=1,width=700,height=650\');">' . t('Javascript crop') . '</a>',
      '#weight' => $weight,
    );
  }
  else {
    $form = array(
      '#type' => 'item',
      '#value' => '<a class="thickbox" href="' . url('imagecrop/showcrop/' . $fid, NULL, NULL, TRUE) . '?KeepThis=true&TB_iframe=true&height=500&width=700">' . t('Javascript crop') . '</a>',
      '#weight' => $weight,
    );
  }
  return $form;
}