public function ResponsiveImageStyle::getImageStyleMapping in Drupal 9
Same name and namespace in other branches
- 8 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::getImageStyleMapping()
- 10 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::getImageStyleMapping()
Gets the image style mapping for a breakpoint ID and multiplier.
Parameters
string $breakpoint_id: The breakpoint ID.
string $multiplier: The multiplier.
Return value
array|null The image style mapping. NULL if the mapping does not exist. The image style mapping has 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 image style mapping.
- multiplier: The multiplier for this image style mapping.
Overrides ResponsiveImageStyleInterface::getImageStyleMapping
File
- core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php, line 255
Class
- ResponsiveImageStyle
- Defines the responsive image style entity.
Namespace
Drupal\responsive_image\EntityCode
public function getImageStyleMapping($breakpoint_id, $multiplier) {
$map = $this
->getKeyedImageStyleMappings();
if (isset($map[$breakpoint_id][$multiplier])) {
return $map[$breakpoint_id][$multiplier];
}
}