You are here

function imagezoom_field_formatter_settings_form in Image Zoom 7.2

Same name and namespace in other branches
  1. 7 imagezoom.module \imagezoom_field_formatter_settings_form()

Implements hook_field_formatter_settings_form().

1 call to imagezoom_field_formatter_settings_form()
imagezoom_gallery_field_formatter_settings_form in modules/imagezoom_gallery/imagezoom_gallery.module
Implements hook_field_formatter_settings_form().

File

./imagezoom.module, line 62
Provides an Image Zoom field formatter for Image fields.

Code

function imagezoom_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element['imagezoom_zoom_type'] = array(
    '#type' => 'select',
    '#title' => t('Zoom type'),
    '#options' => imagezoom_zoom_types(),
    '#default_value' => $settings['imagezoom_zoom_type'],
  );
  $image_styles = image_style_options(FALSE);
  $element['imagezoom_display_style'] = array(
    '#type' => 'select',
    '#title' => t('Display image style'),
    '#options' => $image_styles,
    '#empty_option' => t('None (original image)'),
    '#default_value' => $settings['imagezoom_display_style'],
  );
  $element['imagezoom_zoom_style'] = array(
    '#type' => 'select',
    '#title' => t('Zoomed image style'),
    '#options' => $image_styles,
    '#empty_option' => t('None (original image)'),
    '#default_value' => $settings['imagezoom_zoom_style'],
  );
  $element['imagezoom_disable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable zoom on small screens'),
    '#return_value' => 1,
    '#default_value' => $settings['imagezoom_disable'],
  );
  $element['imagezoom_disable_width'] = array(
    '#type' => 'textfield',
    '#title' => t('Minimum width for zoom to display'),
    '#default_value' => $settings['imagezoom_disable_width'],
    '#size' => 5,
    '#element_validate' => array(
      'element_validate_integer',
    ),
    '#states' => array(
      'invisible' => array(
        ':input[name="fields[field_image][settings_edit_form][settings][imagezoom_disable]"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $element['imagezoom_additional'] = array(
    '#type' => 'textarea',
    '#title' => t('Additional settings'),
    '#default_value' => $settings['imagezoom_additional'],
    '#description' => t('Add additional settings. For a list of available options, see the !docs. Settings should be added in the following format: <pre>@code</pre>', array(
      '!docs' => l(t('documentation'), 'http://igorlino.github.io/elevatezoom-plus/api.htm'),
      '@code' => 'option: value',
    )),
    '#weight' => 20,
    '#element_validate' => array(
      'imagezoom_imagezoom_additional_validate',
    ),
  );
  return $element;
}