function slick_get_image in Slick Carousel 7.2
Same name and namespace in other branches
- 7.3 slick.deprecated.inc \slick_get_image()
Returns the image/video/audio either using Picture mapping, or lazyload.
Parameters
array $settings: The module settings to check for the supported features.
array $media: An array of cherry-picked media information which can be core image, file image/video/audio, or atom.
array $item: An array of the actual image item.
Return value
array The renderable array formatted for the slick_image().
5 calls to slick_get_image()
- slick_format_field_collection in includes/
slick.field_collection.inc - Formats Field collection data.
- slick_format_image in includes/
slick.image.inc - Formats core image data.
- slick_format_media in includes/
slick.media.inc - Formats image/media file data.
- slick_format_paragraphs in includes/
slick.paragraphs.inc - Formats Paragraphs data.
- _slick_build_fc_overlay in includes/
slick.field_collection.inc - Build the managed overlays: image, video, audio or nested slicks.
File
- includes/
slick.global.inc, line 61 - Global functions across Slick field formatters and Views.
Code
function slick_get_image(array $settings = array(), array &$media = array(), array $item = array()) {
// The $media can be core image, file image/video/audio, or atom reference.
// Different fields have different signatures, hence simplify em all.
$media['type'] = empty($media['type']) ? 'image' : $media['type'];
foreach (array(
'alt',
'fid',
'title',
'uri',
'height',
'width',
) as $data) {
$media[$data] = isset($media[$data]) ? $media[$data] : (isset($item[$data]) ? $item[$data] : NULL);
}
// Build the slide with picture, lightbox or multimedia supports.
$image = array(
'#theme' => 'slick_image',
'#image_style' => $settings['image_style'],
'#item' => $media,
'#settings' => $settings,
);
// Ensures disabling Picture while being used doesn't screw up.
$item_attributes = array();
$picture = !empty($settings['picture']) && !empty($settings['picture_ready']);
if ($picture) {
$picture_style = empty($settings['picture_style']) ? 'large' : $settings['picture_style'];
$fallback = $settings['picture_fallback'];
$mappings = picture_mapping_load($picture_style);
$breakpoints = picture_get_mapping_breakpoints($mappings, $fallback);
$item_attributes['breakpoints'] = $breakpoints;
$item_attributes['style_name'] = $fallback;
}
else {
$item_attributes['height'] = $media['height'];
$item_attributes['width'] = $media['width'];
}
$image['#item_attributes'] = $item_attributes;
// Now that picture is inside theme_slick_image(), we can manipulate it.
if (!empty($settings['media_switch']) && $settings['media_switch'] != 'iframe-switch') {
drupal_alter('slick_image_info', $image, $settings, $media);
slick_get_media_switch($image, $item, $settings);
}
unset($item, $settings);
return $image;
}