You are here

function imagecrop_widget_form in Image javascript crop 6

Configuration form for editing Imagecrop settings for a field instance.

1 call to imagecrop_widget_form()
imagecrop_widget_settings_alter in ./imagecrop.module
Implementation of hook_widget_settings_alter().

File

./imagecrop.module, line 222
Provides a javascript toolbox through an imagecache action.

Code

function imagecrop_widget_form($widget) {
  $form['imagecrop'] = array(
    '#type' => 'fieldset',
    '#title' => t('Imagecrop'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('These options allow the user to alter JavaScript crops for specific ImageCache presets.'),
    '#weight' => 15,
  );
  $presets = imagecrop_presets_list();
  if (count($presets) > 0) {
    $form['imagecrop']['imagecrop'] = array(
      '#type' => 'checkbox',
      '#title' => t('Enable JavaScript crop'),
      '#default_value' => (bool) $widget['imagecrop'],
      '#description' => t('Enable JavaScript image crop tool for this widget.'),
    );
    $form['imagecrop']['imagecrop_presets'] = array(
      '#title' => t('Enabled imagecrop presets'),
      '#type' => 'checkboxes',
      '#options' => $presets,
      '#default_value' => (array) $widget['imagecrop_presets'],
      '#description' => t('Select which Imagecache presets should be available for cropping. If no presets are selected, the option to crop the image is not displayed.'),
    );
  }
  else {
    $form['imagecrop']['imagecrop_warning'] = array(
      '#value' => t('No preset is found with the javascript_crop action so far. If you want to take advantage of this module, you will need to create at least one preset with that action.'),
    );
  }
  return $form;
}