You are here

function image_crop_form in Drupal 7

Form structure for the image crop form.

Note that this is not a complete form, it only contains the portion of the form for configuring the crop options. Therefore it does not not need to include metadata about the effect, nor a submit button.

Parameters

$data: The current configuration for this crop effect.

1 string reference to 'image_crop_form'
image_image_effect_info in modules/image/image.effects.inc
Implements hook_image_effect_info().

File

modules/image/image.admin.inc, line 583
Administration pages for image settings.

Code

function image_crop_form($data) {
  $data += array(
    'width' => '',
    'height' => '',
    'anchor' => 'center-center',
  );
  $form = image_resize_form($data);
  $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' => $data['anchor'],
    '#description' => t('The part of the image that will be retained during the crop.'),
  );
  return $form;
}