public static function ResponsiveImageStyle::isEmptyImageStyleMapping in Drupal 8
Same name and namespace in other branches
- 9 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::isEmptyImageStyleMapping()
Checks if there is at least one image style mapping defined.
Parameters
array $image_style_mapping: The image style mapping.
Return value
bool Whether the image style mapping is empty.
Overrides ResponsiveImageStyleInterface::isEmptyImageStyleMapping
1 call to ResponsiveImageStyle::isEmptyImageStyleMapping()
- ResponsiveImageStyle::getKeyedImageStyleMappings in core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php - Returns the mappings of breakpoint ID and multiplier to image style.
File
- core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php, line 230
Class
- ResponsiveImageStyle
- Defines the responsive image style entity.
Namespace
Drupal\responsive_image\EntityCode
public static function isEmptyImageStyleMapping(array $image_style_mapping) {
if (!empty($image_style_mapping)) {
switch ($image_style_mapping['image_mapping_type']) {
case 'sizes':
// The image style mapping must have a sizes attribute defined and one
// or more image styles selected.
if ($image_style_mapping['image_mapping']['sizes'] && $image_style_mapping['image_mapping']['sizes_image_styles']) {
return FALSE;
}
break;
case 'image_style':
// The image style mapping must have an image style selected.
if ($image_style_mapping['image_mapping']) {
return FALSE;
}
break;
}
}
return TRUE;
}