function image_max_size_crop_form in Image max size crop 7
Form structure for the image max resize form.
Note that this is not a complete form, it only contains the portion of the form for configuring the resize options. Therefore it does not not need to include metadata about the effect, nor a submit button.
Parameters
array $data: The current configuration for this resize effect.
1 string reference to 'image_max_size_crop_form'
File
- ./
image_max_size_crop.module, line 172 - Functions needed to create an image style.
Code
function image_max_size_crop_form(array $data) {
$form['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => isset($data['width']) ? $data['width'] : '',
'#field_suffix' => ' ' . t('pixels'),
'#size' => 10,
'#element_validate' => array(
'image_effect_integer_validate',
),
'#allow_negative' => FALSE,
);
$form['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => isset($data['height']) ? $data['height'] : '',
'#field_suffix' => ' ' . t('pixels'),
'#size' => 10,
'#element_validate' => array(
'image_effect_integer_validate',
),
'#allow_negative' => FALSE,
);
// Reuse validation function from scaling.
// Ensures either width or heigth is set.
$form['#element_validate'] = array(
'image_effect_scale_validate',
);
$form['anchor'] = array(
'#type' => 'radios',
'#title' => t('Anchor'),
'#options' => array(
'left-top' => t('Top left'),
'center-top' => t('Top center'),
'right-top' => t('Top right'),
'left-center' => t('Center left'),
'center-center' => t('Center'),
'right-center' => t('Center right'),
'left-bottom' => t('Bottom left'),
'center-bottom' => t('Bottom center'),
'right-bottom' => t('Bottom right'),
),
'#theme' => 'image_anchor',
'#default_value' => isset($data['anchor']) ? $data['anchor'] : 'center-center',
'#description' => t('The part of the image that will be retained during the crop.'),
);
return $form;
}