function imagecrop_effect_form in Image javascript crop 7
Settings form for configuring a javascript imagecrop effect.
1 string reference to 'imagecrop_effect_form'
- imagecrop_image_effect_info in includes/
imagecrop.effects.inc - Implements hook_image_effect_info().
File
- includes/
imagecrop.effects.inc, line 76 - Registry for the image style effects from imagecrop.
Code
function imagecrop_effect_form($data) {
$form = array();
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => isset($data['width']) ? $data['width'] : '',
'#required' => TRUE,
'#size' => 10,
'#element_validate' => array(
'image_crop_validate_size',
),
'#description' => t('Enter the width in pixels or %'),
);
$form['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => isset($data['height']) ? $data['height'] : '',
'#required' => TRUE,
'#size' => 10,
'#element_validate' => array(
'image_crop_validate_size',
),
'#description' => t('Enter the height in pixels or %'),
);
$form['xoffset'] = array(
'#type' => 'textfield',
'#title' => t('X offset'),
'#default_value' => isset($data['xoffset']) ? $data['xoffset'] : '',
'#description' => t('Enter an offset in pixels (without px) or use a keyword: <em>left</em>, <em>center</em>, or <em>right</em>.'),
'#element_validate' => array(
'imagecrop_validate_offset',
),
);
$form['yoffset'] = array(
'#type' => 'textfield',
'#title' => t('Y offset'),
'#default_value' => isset($data['yoffset']) ? $data['yoffset'] : '',
'#description' => t('Enter an offset in pixels (without px) or use a keyword: <em>top</em>, <em>center</em> or <em>bottom</em>.'),
'#element_validate' => array(
'imagecrop_validate_offset',
),
);
$form['resizable'] = array(
'#type' => 'checkbox',
'#title' => t('Resizable toolbox'),
'#default_value' => isset($data['resizable']) ? $data['resizable'] : '',
'#description' => t('If the toolbox is resized, the crop values won\'t be respected, so you should add a Scale action after the ImageCrop.'),
);
$form['downscaling'] = array(
'#type' => 'checkbox',
'#title' => t('Do not allow down scaling'),
'#default_value' => isset($data['downscaling']) ? $data['downscaling'] : FALSE,
'#description' => t('If checked, you can\'t resize the toolbox smaller than width and height.'),
);
$description = t('Enter an aspect ratio to preserve during resizing. This can take one of the following formats:');
$description .= '<ul><li>' . t('A float (like 0.5 or 2).') . '</li>';
$description .= '<li>' . t('The string \'KEEP\'. This will constrain the aspect ratio to that of the original image.') . '</li>';
$description .= '<li>' . t('The string \'CROP\'. This will constrain the aspect ratio to the dimensions set above.') . '</li></ul>';
$description .= t('Leave blank for no aspect ratio constraints.');
$form['aspect_ratio'] = array(
'#type' => 'textfield',
'#title' => t('Aspect ratio'),
'#default_value' => isset($data['aspect_ratio']) ? $data['aspect_ratio'] : '',
'#description' => $description,
'#element_validate' => array(
'imagecrop_validate_aspect',
),
);
$form['disable_if_no_data'] = array(
'#type' => 'checkbox',
'#title' => t('Don\'t crop if cropping region wasn\'t set.'),
'#default_value' => isset($data['disable_if_no_data']) ? $data['disable_if_no_data'] : FALSE,
);
return $form;
}