You are here

function imagefield_crop_widget_settings_form in Imagefield Crop 6

1 call to imagefield_crop_widget_settings_form()
imagefield_crop_widget_settings in ./imagefield_crop.module
Implementation of CCK's hook_widget_settings().

File

./imagefield_crop_widget.inc, line 8

Code

function imagefield_crop_widget_settings_form($widget) {
  $form = module_invoke('imagefield', 'widget_settings_form', $widget);
  $form['resolution'] = array(
    '#type' => 'textfield',
    '#title' => t('The resolution to crop the image onto'),
    '#default_value' => isset($widget['resolution']) ? $widget['resolution'] : '200x150',
    '#size' => 15,
    '#maxlength' => 10,
    '#description' => t('The output resolution of the cropped image, expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 not to rescale after cropping. Note: output resolution must be defined in order to present a dynamic preview.'),
    '#element_validate' => array(
      '_imagefield_crop_widget_settings_resolution_validate',
    ),
  );
  $form['enforce_ratio'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enforce crop box ratio'),
    '#default_value' => isset($widget['enforce_ratio']) ? $widget['enforce_ratio'] : 1,
    '#description' => t('Check this to force the ratio of the output on the crop box. NOTE: If you leave this unchecked but enforce an output resolution, the final image might be distorted.'),
    '#element_validate' => array(
      '_imagefield_crop_widget_settings_enforce_ratio_validate',
    ),
  );
  $form['enforce_minimum'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enforce minimum crop size based on the output size'),
    '#default_value' => isset($widget['enforce_minimum']) ? $widget['enforce_minimum'] : 1,
    '#description' => t('Check this to force a minimum cropping selection equal to the output size. NOTE: If you leave this unchecked you might get zoomed pixels if the cropping area is smaller than the output resolution.'),
    '#element_validate' => array(
      '_imagefield_crop_widget_settings_enforce_minimum',
    ),
  );
  $form['croparea'] = array(
    '#type' => 'textfield',
    '#title' => t('The resolution of the cropping area'),
    '#default_value' => isset($widget['croparea']) ? $widget['croparea'] : '500x500',
    '#size' => 15,
    '#maxlength' => 10,
    '#description' => t('The resolution of the area used for the cropping of the image. Image will displayed at this resolution for cropping. Use WIDTHxHEIGHT format, zero values are permitted, e.g. 500x0 will limit crop box to 500 pixels width.'),
    '#element_validate' => array(
      '_imagefield_crop_widget_settings_croparea_validate',
    ),
  );
  $form['preview_width'] = array(
    '#type' => 'textfield',
    '#title' => t('The maximum width of the preview area'),
    '#default_value' => isset($widget['preview_width']) ? $widget['preview_width'] : '500',
    '#size' => 15,
    '#maxlength' => 10,
    '#description' => t('The width entered here will restrain the with of the preview area. Use 0 if you\'d prefer no maximum width.'),
    '#element_validate' => array(
      '_imagefield_crop_widget_settings_preview_width_validate',
    ),
  );
  return $form;
}