You are here

function imagecrop_settings_form in Image javascript crop 7

General settings form from the imagecrop module.

1 string reference to 'imagecrop_settings_form'
imagecrop_menu in ./imagecrop.module
Implements hook_menu().

File

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

Code

function imagecrop_settings_form() {
  $all_popups = array(
    'basic' => t('Basic popup window'),
  );
  foreach (module_implements('imagecrop_popups') as $module_name) {
    $function = $module_name . '_imagecrop_popups';
    $popups = $function();
    if (is_array($popups)) {
      $all_popups += $popups;
    }
  }
  $form['imagecrop_popup'] = array(
    '#type' => 'radios',
    '#title' => t('Popup window type'),
    '#default_value' => variable_get('imagecrop_popup', 'imagecrop_jquery_dialog'),
    '#options' => $all_popups,
  );
  $options_modules = array(
    'profile_picture' => t('Profile pictures'),
    'media' => t('Media edit form (not media fields)'),
  );
  $form['imagecrop_theme'] = array(
    '#type' => 'radios',
    '#title' => t('Theme for imagecrop popups'),
    '#default_value' => variable_get('imagecrop_theme', 'admin_theme'),
    '#options' => array(
      'admin_theme' => t('Admin theme'),
      'theme_default' => t('Frontend theme'),
    ),
  );
  $form['imagecrop_modules'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Trigger imagecrop also for'),
    '#default_value' => variable_get('imagecrop_modules', array()),
    '#options' => $options_modules,
  );
  $form['imagecrop_popup_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Popup window width'),
    '#default_value' => variable_get('imagecrop_popup_width', 700),
    '#size' => 4,
    '#field_suffix' => 'pixels',
  );
  $form['imagecrop_popup_height'] = array(
    '#type' => 'textfield',
    '#title' => t('Popup window height'),
    '#default_value' => variable_get('imagecrop_popup_height', 600),
    '#size' => 4,
    '#field_suffix' => 'pixels',
  );
  $form['imagecrop_show_cancel_button'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show cancel button'),
    '#default_value' => variable_get('imagecrop_show_cancel_button', FALSE),
    '#description' => t('Show a cancel button in the popup.'),
  );
  $form['imagecrop_skip_preview'] = array(
    '#type' => 'checkbox',
    '#title' => t('Skip image previews'),
    '#default_value' => variable_get('imagecrop_skip_preview', FALSE),
    '#description' => t('Popup opens crop page, instead of preview first.'),
  );
  $form['imagecrop_ui_controls'] = array(
    '#type' => 'checkbox',
    '#title' => t('Advanced UI controls'),
    '#default_value' => variable_get('imagecrop_ui_controls', FALSE),
    '#description' => t('Show a sidebar with live cropping info and the possibility to insert width / height'),
  );
  $form['imagecrop_scale_step'] = array(
    '#type' => 'textfield',
    '#title' => t('Step size for scale dropdown'),
    '#default_value' => variable_get('imagecrop_scale_step', 50),
    '#size' => 4,
    '#field_suffix' => 'pixels',
  );
  $form['imagecrop_scale_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Autoscale the initial crop to fit the popup.'),
    '#default_value' => variable_get('imagecrop_scale_default', FALSE),
  );
  $form['imagecrop_rotation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow rotation from image'),
    '#default_value' => variable_get('imagecrop_rotation', FALSE),
    '#description' => t('When enabled, editors will be aible to rotate the image'),
  );

  // drupal message if no action is found with javascript_crop
  if (count(get_imagecrop_styles()) == 0) {
    drupal_set_message(t('No image style 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 image style with that action.'));
  }
  return system_settings_form($form);
}