1 image.field.inc image_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state)

Implements hook_field_formatter_settings_form().

File

core/modules/image/image.field.inc, line 648
Implement an image field, based on the file module's file field.

Code

function image_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];

  $image_styles = image_style_options(FALSE, PASS_THROUGH);
  $element['image_style'] = array(
    '#title' => t('Image style'),
    '#type' => 'select',
    '#default_value' => $settings['image_style'],
    '#empty_option' => t('None (original image)'),
    '#options' => $image_styles,
  );

  $link_types = array(
    'content' => t('Content'),
    'file' => t('File'),
  );
  $element['image_link'] = array(
    '#title' => t('Link image to'),
    '#type' => 'select',
    '#default_value' => $settings['image_link'],
    '#empty_option' => t('Nothing'),
    '#options' => $link_types,
  );

  $element['image_float'] = array(
    '#title' => t('Float image'),
    '#type' => 'select',
    '#description' => t('Display the image on the left or right, with the rest of the content wrapping around it.'),
    '#default_value' => $settings['image_float'],
    '#empty_option' => t('No'),
    '#options' => array(
      'left' => t('Left'),
      'right' => t('Right'),
    ),
  );

  if (!isset($settings['image_load'])) {
    $settings['image_load'] = 'auto';
  }

  $element['image_load'] = array(
    '#title' => t('Image loading'),
    '#type' => 'radios',
    '#default_value' => $settings['image_load'],
    '#options' => array(
      'lazy' => t('Lazy'),
      'auto' => t('Automatic'),
      'eager' => t('Eager'),
    ),
  );
  $element['image_load']['lazy']['#description'] = t('Defer loading offscreen images until viewers scroll nearby. "Nearby" is determined by each browser.');
  $element['image_load']['auto']['#description'] = t('Each browser will determine whether or not to lazily load the image.');
  $element['image_load']['eager']['#description'] = t('Load this image immediately, regardless of where it is located on the page.');

  return $element;
}