You are here

function epsacrop_crop_image_form in EPSA Crop - Image Cropping 8.2

Same name and namespace in other branches
  1. 7.2 epsacrop.module \epsacrop_crop_image_form()

Function that provide the effect form settings for dialog crop.

@access public

Parameters

mixed $data:

Return value

void

1 string reference to 'epsacrop_crop_image_form'
epsacrop_image_effect_info in ./epsacrop.module
Implements hook_image_effect_info.

File

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

Code

function epsacrop_crop_image_form($data) {
  $data += array(
    'jcrop_settings' => array(
      'bgcolor' => 'black',
      'bgopacity' => '0.6',
    ),
  );

  //@TODO Propose a alternative style (whitout Crop Dialog effect) instead of this
  $form = image_crop_form($data);

  // Change description for the anchor
  $form['anchor']['#description'] = t("The part of the image that will be retained during the crop if no coordonates will set.");
  $form['jcrop_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t("Advanced settings"),
    '#collapsed' => TRUE,
    '#collapsible' => TRUE,
  );
  $form['jcrop_settings']['aspect_ratio'] = array(
    '#type' => 'textfield',
    '#title' => t('Aspect Ratio'),
    '#description' => t("Aspect ratio of w/h (e.g. 1 for square)"),
    '#default_value' => isset($data['jcrop_settings']['aspect_ratio']) ? $data['jcrop_settings']['aspect_ratio'] : '',
    // '#field_suffix' => ' ' . t('pixels'),
    // '#required' => TRUE,
    '#size' => 10,
    '#element_validate' => array(
      '_epsacrop_aspect_ratio_validate',
    ),
  );

  /*
  $form['jcrop_settings']['minsize'] = array();
  $form['jcrop_settings']['maxsize'] = array();
  */
  $form['jcrop_settings']['bgcolor'] = array(
    '#type' => 'textfield',
    '#title' => t('Background color'),
    '#description' => t("Set color of background container"),
    '#default_value' => isset($data['jcrop_settings']['bgcolor']) ? $data['jcrop_settings']['bgcolor'] : '',
    // '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 10,
  );
  $form['jcrop_settings']['bgopacity'] = array(
    '#type' => 'textfield',
    '#title' => t('Background opacity'),
    '#description' => t("Opacity of outer image when cropping"),
    '#default_value' => isset($data['jcrop_settings']['bgopacity']) ? $data['jcrop_settings']['bgopacity'] : '',
    // '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 10,
  );
  return $form;
}