function imagezoom_field_formatter_view in Image Zoom 7.2
Same name and namespace in other branches
- 7 imagezoom.module \imagezoom_field_formatter_view()
Implements hook_field_formatter_view().
File
- ./
imagezoom.module, line 176 - Provides an Image Zoom field formatter for Image fields.
Code
function imagezoom_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$display_style = $display['settings']['imagezoom_display_style'];
$zoom_style = $display['settings']['imagezoom_zoom_style'];
$settings = array(
'zoomType' => $display['settings']['imagezoom_zoom_type'],
);
if ($display['settings']['imagezoom_disable']) {
$settings['responsive'] = TRUE;
$settings['respond'] = array(
array(
'range' => '0 - ' . $display['settings']['imagezoom_disable_width'],
'enabled' => FALSE,
),
);
}
$additonal_settings = imagezoom_settings_to_array($display['settings']['imagezoom_additional']);
$settings += $additonal_settings;
$context = array(
'field' => $field,
'instance' => $instance,
);
drupal_alter('imagezoom_settings', $settings, $context);
$element = array();
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'imagezoom_image',
'#item' => $item,
'#display_style' => $display_style,
'#zoom_style' => $zoom_style,
'#settings' => $settings,
);
}
return $element;
}