Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ResponsiveImageStyle.php

function ResponsiveImageStyle::isEmptyImageStyleMapping

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 252

Class

ResponsiveImageStyle
Defines the responsive image style entity.

Namespace

Drupal\responsive_image\Entity

Code

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;
}
RSS feed
Powered by Drupal