You are here

function imagecrop_crop_settings_form in Image javascript crop 7

Settings form from the current crop.

1 string reference to 'imagecrop_crop_settings_form'
imagecrop_cropping_page in includes/imagecrop.admin.inc
Show the cropping page for the selected image style.

File

includes/imagecrop.admin.inc, line 284
Administration tools for the imagecrop module.

Code

function imagecrop_crop_settings_form($form, $form_state, $imagecrop) {
  $type = $imagecrop->extraControls ? 'textfield' : 'hidden';
  $form['image-crop-x'] = array(
    '#type' => $type,
    '#title' => t('X position'),
    '#default_value' => $imagecrop
      ->getXOffset(),
  );
  $form['image-crop-y'] = array(
    '#type' => $type,
    '#title' => t('Y position'),
    '#default_value' => $imagecrop
      ->getYOffset(),
  );
  $form['image-crop-width'] = array(
    '#type' => $imagecrop
      ->isResizable() ? $type : 'hidden',
    '#title' => t('Width'),
    '#default_value' => $imagecrop
      ->getWidth(),
  );
  $form['image-crop-height'] = array(
    '#type' => $imagecrop
      ->isResizable() ? $type : 'hidden',
    '#title' => t('Height'),
    '#default_value' => $imagecrop
      ->getHeight(),
  );
  $form['image-crop-scale'] = array(
    '#type' => 'hidden',
    '#default_value' => $imagecrop
      ->getScale(),
  );
  $form['image-crop-rotation'] = array(
    '#type' => 'hidden',
    '#default_value' => $imagecrop
      ->getRotation(),
  );
  $form['fid'] = array(
    '#type' => 'hidden',
    '#value' => $imagecrop
      ->getFile()->fid,
  );
  $form['field'] = array(
    '#type' => 'hidden',
    '#value' => serialize(array(
      $imagecrop
        ->getEntityType(),
      $imagecrop
        ->getBundle(),
      $imagecrop
        ->getFieldName(),
    )),
  );
  $image_style = $imagecrop
    ->getImageStyle();
  $form['style'] = array(
    '#type' => 'hidden',
    '#value' => $image_style['name'],
  );
  $form['style-destination'] = array(
    '#type' => 'hidden',
    '#value' => $imagecrop
      ->getStyleDestination(),
  );
  $form['temp-style-destination'] = array(
    '#type' => 'hidden',
    '#value' => $imagecrop
      ->getCropDestination(TRUE, FALSE),
  );
  $form['temp-style-uri'] = array(
    '#type' => 'hidden',
    '#value' => $imagecrop
      ->getCropDestination(FALSE, FALSE),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save selection'),
  );
  return $form;
}