public function ResponsiveImageStyle::getImageStyleIds in Drupal 9
Same name and namespace in other branches
- 8 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::getImageStyleIds()
- 10 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::getImageStyleIds()
Gets all the image styles IDs involved in the responsive image mapping.
Return value
string[]
Overrides ResponsiveImageStyleInterface::getImageStyleIds
1 call to ResponsiveImageStyle::getImageStyleIds()
- ResponsiveImageStyle::calculateDependencies in core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php - Calculates dependencies and stores them in the dependency property.
File
- core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php, line 265
Class
- ResponsiveImageStyle
- Defines the responsive image style entity.
Namespace
Drupal\responsive_image\EntityCode
public function getImageStyleIds() {
$image_styles = [
$this
->getFallbackImageStyle(),
];
foreach ($this
->getImageStyleMappings() as $image_style_mapping) {
// Only image styles of non-empty mappings should be loaded.
if (!$this::isEmptyImageStyleMapping($image_style_mapping)) {
switch ($image_style_mapping['image_mapping_type']) {
case 'image_style':
$image_styles[] = $image_style_mapping['image_mapping'];
break;
case 'sizes':
$image_styles = array_merge($image_styles, $image_style_mapping['image_mapping']['sizes_image_styles']);
break;
}
}
}
return array_values(array_filter(array_unique($image_styles)));
}