You are here

function picture_file_formatter_picture_settings in Picture 7

Same name and namespace in other branches
  1. 7.2 picture.file_entity_1.inc \picture_file_formatter_picture_settings()

'settings callback' for hook_file_formatter_info().

1 string reference to 'picture_file_formatter_picture_settings'
picture_file_formatter_info in ./picture.file_entity_1.inc
Implements hook_file_formatter_info().

File

./picture.file_entity_1.inc, line 107
Hooks and functions to support version 1 of the File Entity module.

Code

function picture_file_formatter_picture_settings($form, &$form_state, $settings) {
  $picture_group_options = array();
  $picture_mappings = picture_mapping_load_all();
  if ($picture_mappings && !empty($picture_mappings)) {
    foreach ($picture_mappings as $machine_name => $picture_mapping) {
      $breakpoint_group = breakpoints_breakpoint_group_load($picture_mapping->breakpoint_group);
      if ($breakpoint_group) {
        $picture_group_options[$machine_name] = $breakpoint_group->name;
      }
    }
  }
  $element['picture_group'] = array(
    '#title' => t('Picture group'),
    '#type' => 'select',
    '#default_value' => $settings['picture_group'],
    '#required' => TRUE,
    '#options' => $picture_group_options,
  );
  $image_styles = image_style_options(FALSE);
  $element['fallback_image_style'] = array(
    '#title' => t('Fallback image style'),
    '#type' => 'select',
    '#default_value' => $settings['fallback_image_style'],
    '#empty_option' => t('Automatic'),
    '#options' => $image_styles,
  );
  $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'],
  );
  return $element;
}