1 file.module file_file_formatter_file_image_settings($form, &$form_state, $settings)

Implements hook_file_formatter_FORMATTER_settings().

Returns form elements for configuring the 'file_image' formatter.

File

core/modules/file/file.module, line 800
Defines a "managed_file" Form API field and a "file" field for Field module.

Code

function file_file_formatter_file_image_settings($form, &$form_state, $settings) {
  $element = array();
  $element['image_style'] = array(
    '#title' => t('Image style'),
    '#type' => 'select',
    '#options' => image_style_options(FALSE),
    '#default_value' => $settings['image_style'],
    '#empty_option' => t('None (original image)'),
  );

  // For image files we allow the alt attribute (required in HTML).
  $element['alt'] = array(
    '#title' => t('Alt attribute'),
    '#description' => t('The text to use as value for the <em>img</em> tag <em>alt</em> attribute.'),
    '#type' => 'textfield',
    '#default_value' => $settings['alt'],
  );

  // Allow the setting of the title attribute.
  $element['title'] = array(
    '#title' => t('Title attribute'),
    '#description' => t('The text to use as value for the <em>img</em> tag <em>title</em> attribute.'),
    '#type' => 'textfield',
    '#default_value' => $settings['title'],
  );

  $element['alt']['#description'] .= t('This field supports tokens.');
  $element['title']['#description'] .= t('This field supports tokens.');
  $element['tokens'] = array(
    '#theme' => 'token_tree',
    '#token_types' => array('file'),
    '#dialog' => TRUE,
  );

  return $element;
}