1 image.admin.inc image_crop_form($data)

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.

File

core/modules/image/image.admin.inc, line 523
Admin page callbacks for the Image module.

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;
}