You are here

function imagezoomer_settings_form in Image Zoomer 7

Build powerzoomer settings form.

1 string reference to 'imagezoomer_settings_form'
imagezoomer_menu in ./imagezoomer.module
Implements hook_menu().

File

./imagezoomer.module, line 370
Integrate Powerzoomer / Featuredzoom jquery plugins to Drupal 7

Code

function imagezoomer_settings_form($form, &$form_state) {
  $form = array();

  // We check libraries (Powerzoomer and Featurezoomer).
  // If doesn't exist, we recommend user to download these plugins.
  $powerzoomer_up = TRUE;
  $featuredzoomer_up = TRUE;
  if (!is_readable('sites/all/libraries/imagezoomer/ddpowerzoomer.js')) {
    $powerzoomer_link = l('http://www.dynamicdrive.com/dynamicindex4/powerzoomer.htm', 'http://www.dynamicdrive.com/dynamicindex4/powerzoomer.htm', array(
      'external' => true,
    ));
    drupal_set_message(t('JQuery plugin for Powerzoomer is not found. Please download at ' . $powerzoomer_link . ' then upload it to under this folder /sites/all/libraries/imagezoomer'), 'warning');
    $powerzoomer_up = FALSE;
  }
  if (!is_readable('sites/all/libraries/imagezoomer/multizoom.js')) {
    $featuredzoomer_link = l('http://www.dynamicdrive.com/dynamicindex4/featuredzoomer.htm', 'http://www.dynamicdrive.com/dynamicindex4/featuredzoomer.htm', array(
      'external' => true,
    ));
    drupal_set_message(t('JQuery plugin for Featuredzoomer is not found. Please download at ' . $featuredzoomer_link . ' then upload it to under this folder /sites/all/libraries/imagezoomer'), 'warning');
    $featuredzoomer_up = FALSE;
  }

  // Return blank page if none plugins were setup.
  if (!$powerzoomer_up and !$featuredzoomer_up) {
    return $form;
  }

  // For Powerzoomer.
  if ($powerzoomer_up) {
    $form['imagezoomer_power_plugin_options'] = array(
      '#type' => 'fieldset',
      '#title' => t('Powerzoomer JQuery plug-in options'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#description' => t('More details for the options, please visit this original website at ') . l('http://www.dynamicdrive.com/dynamicindex4/powerzoomer.htm', 'http://www.dynamicdrive.com/dynamicindex4/powerzoomer.htm', array(
        'external' => true,
      )),
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_default_power'] = array(
      '#type' => 'textfield',
      '#title' => t('Default power value'),
      '#description' => t('Sets the default magnification power when the mouse rolls over the image. Value should be an integer greater / equal 1 and less / equal to 10.'),
      '#default_value' => variable_get('imagezoomer_power_default_power', 2),
      '#required' => TRUE,
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_power_range'] = array(
      '#type' => 'fieldset',
      '#title' => t('Power range'),
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
      '#description' => t('Sets the range of possible magnification powers when the user scrolls the mouse wheel while over the target image. Be sure this range covers the defaultpower setting above.'),
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_power_range']['imagezoomer_power_power_range_low'] = array(
      '#type' => 'textfield',
      '#title' => t('Power range low value'),
      '#default_value' => variable_get('imagezoomer_power_power_range_low', 2),
      '#description' => t('Value should be greater than 0.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_power_range']['imagezoomer_power_power_range_high'] = array(
      '#type' => 'textfield',
      '#title' => t('Power range high value'),
      '#default_value' => variable_get('imagezoomer_power_power_range_high', 7),
      '#description' => t('Value should be greater than the low range value.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_magnifier_size'] = array(
      '#type' => 'fieldset',
      '#title' => t('Magnifier size'),
      '#collapsible' => TRUE,
      '#description' => t('Sets the dimensions of the magnifier that appears over the target image. For large images it makes sense to take advantage of that real estate by also increasing the magnifier\'s size.'),
      '#collapsed' => FALSE,
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_magnifier_size']['imagezoomer_power_magnifier_size_width'] = array(
      '#type' => 'textfield',
      '#title' => t('Magnifier size width'),
      '#default_value' => variable_get('imagezoomer_power_magnifier_size_width', 75),
      '#description' => t('Value should be greater than 0.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_power_plugin_options']['imagezoomer_power_magnifier_size']['imagezoomer_power_magnifier_size_height'] = array(
      '#type' => 'textfield',
      '#title' => t('Magnifier size height'),
      '#default_value' => variable_get('imagezoomer_power_magnifier_size_height', 75),
      '#description' => t('Value should be greater than 0.'),
      '#required' => TRUE,
    );
  }

  // For Featuredzoomer.
  if ($featuredzoomer_up) {
    $form['imagezoomer_featured_plugin_options'] = array(
      '#type' => 'fieldset',
      '#title' => t('Featuredzoomer JQuery plug-in options'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#description' => t('More details for the options, please visit this original website at ') . l('http://www.dynamicdrive.com/dynamicindex4/featuredzoomer.htm', 'http://www.dynamicdrive.com/dynamicindex4/featuredzoomer.htm', array(
        'external' => true,
      )),
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_power_range'] = array(
      '#type' => 'fieldset',
      '#title' => t('Power range'),
      '#collapsible' => TRUE,
      '#description' => t('Sets the range of possible magnification powers when the user scrolls the mouse wheel while over the target image.'),
      '#collapsed' => FALSE,
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_power_range']['imagezoomer_featured_power_range_low'] = array(
      '#type' => 'textfield',
      '#title' => t('Power range low value'),
      '#default_value' => variable_get('imagezoomer_featured_power_range_low', 2),
      '#description' => t('Value should be greater than 0.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_power_range']['imagezoomer_featured_power_range_high'] = array(
      '#type' => 'textfield',
      '#title' => t('Power range high value'),
      '#default_value' => variable_get('imagezoomer_featured_power_range_high', 7),
      '#description' => t('Value should be greater than the low range value.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_magnifier_size'] = array(
      '#type' => 'fieldset',
      '#title' => t('Magnifier size'),
      '#collapsible' => TRUE,
      '#description' => t('Sets the dimensions of the magnifier that appears over the target image.'),
      '#collapsed' => FALSE,
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_magnifier_size']['imagezoomer_featured_magnifier_size_width'] = array(
      '#type' => 'textfield',
      '#title' => t('Magnifier size width'),
      '#default_value' => variable_get('imagezoomer_featured_magnifier_size_width', 200),
      '#description' => t('Value should be greater than 0.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_magnifier_size']['imagezoomer_featured_magnifier_size_height'] = array(
      '#type' => 'textfield',
      '#title' => t('Magnifier size height'),
      '#default_value' => variable_get('imagezoomer_featured_magnifier_size_height', 200),
      '#description' => t('Value should be greater than 0.'),
      '#required' => TRUE,
    );
    $form['imagezoomer_featured_plugin_options']['imagezoomer_featured_magnifier_position'] = array(
      '#type' => 'radios',
      '#title' => t('Position for the magnifier'),
      '#options' => array(
        'left' => 'Left',
        'right' => 'Right',
      ),
      '#default_value' => variable_get('imagezoomer_featured_magnifier_position', 'right'),
      '#description' => t('Currently supports for only left and right position.'),
      '#required' => TRUE,
    );
  }
  return system_settings_form($form);
}