public 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
File
- core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php, line 133
Class
- ResponsiveImageStyle
- Defines the responsive image style entity.
Namespace
Drupal\responsive_image\Entity
Code
1 2 3 4 5 6 7 8 9 10 11 | 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; } |
Please login to continue.