You are here

function focal_point_crop_form in Focal Point 7

Form builder for the scale and crop forms.

1 string reference to 'focal_point_crop_form'
focal_point_image_effect_info in ./focal_point.effects.inc
Implements hook_image_effect_info().

File

./focal_point.effects.inc, line 56
Default image preset.

Code

function focal_point_crop_form($data = array()) {
  $form = image_crop_form($data);
  unset($form['anchor']);

  // Add input fields for focal point shifting.
  $form['focal_point_advanced'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['focal_point_advanced']['shift_x'] = array(
    '#type' => 'textfield',
    '#title' => 'Horizontal Shift',
    '#description' => t('If set images will be cropped as though the focal point indicator has been shifted left (positive values) or shifted right (negative values) by the number of pixels specified.'),
    '#default_value' => isset($data['focal_point_advanced']['shift_x']) ? $data['focal_point_advanced']['shift_x'] : '',
    '#field_suffix' => t('pixels'),
    '#size' => 10,
    '#element_validate' => array(
      'image_effect_integer_validate',
    ),
    '#allow_negative' => TRUE,
  );
  $form['focal_point_advanced']['shift_y'] = array(
    '#type' => 'textfield',
    '#title' => 'Veritical Shift',
    '#description' => t('If set images will be cropped as though the focal point indicator has been shifted up (positive values) or shifted down (negative values) by the number of pixels specified.'),
    '#default_value' => isset($data['focal_point_advanced']['shift_y']) ? $data['focal_point_advanced']['shift_y'] : '',
    '#field_suffix' => t('pixels'),
    '#size' => 10,
    '#element_validate' => array(
      'image_effect_integer_validate',
    ),
    '#allow_negative' => TRUE,
  );
  return $form;
}