public function ResponsiveImageStyle::getKeyedImageStyleMappings in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::getKeyedImageStyleMappings()
Returns the mappings of breakpoint ID and multiplier to image style.
Return value
array[] The image style mappings. Keyed by breakpoint ID then multiplier. The value is the image style mapping array with following keys:
- image_mapping_type: Either 'image_style' or 'sizes'.
- image_mapping:
- If image_mapping_type is 'image_style', the image style ID.
- If image_mapping_type is 'sizes', an array with following keys:
- sizes: The value for the 'sizes' attribute.
- sizes_image_styles: The image styles to use for the 'srcset' attribute.
- breakpoint_id: The breakpoint ID for this mapping.
- multiplier: The multiplier for this mapping.
Overrides ResponsiveImageStyleInterface::getKeyedImageStyleMappings
2 calls to ResponsiveImageStyle::getKeyedImageStyleMappings()
- ResponsiveImageStyle::getImageStyleMapping in core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php - Gets the image style mapping for a breakpoint ID and multiplier.
- ResponsiveImageStyle::hasImageStyleMappings in core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php - Checks if there is at least one mapping defined.
File
- core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php, line 138 - Contains \Drupal\responsive_image\Entity\ResponsiveImageStyle.
Class
- ResponsiveImageStyle
- Defines the responsive image style entity.
Namespace
Drupal\responsive_image\EntityCode
public function getKeyedImageStyleMappings() {
if (!$this->keyedImageStyleMappings) {
$this->keyedImageStyleMappings = array();
foreach ($this->image_style_mappings as $mapping) {
if (!static::isEmptyImageStyleMapping($mapping)) {
$this->keyedImageStyleMappings[$mapping['breakpoint_id']][$mapping['multiplier']] = $mapping;
}
}
}
return $this->keyedImageStyleMappings;
}