You are here

private static function ResponsiveBackgroundImage::createFallbackMediaQuery in Responsive Background Image 8

Parameters

string $css_selector: CSS selector for element that will have background image.

string $fallback_image_path: Path to the fallback image.

Return value

string A CSS property for a fallback background image.

1 call to ResponsiveBackgroundImage::createFallbackMediaQuery()
ResponsiveBackgroundImage::generateMediaQueries in src/ResponsiveBackgroundImage.php
Generates a Drupal style tag array containing CSS media queries to apply a responsive background image to a specific DOM element/node. The return value must be assigned correctly. See the return description below.

File

src/ResponsiveBackgroundImage.php, line 184

Class

ResponsiveBackgroundImage
Provides a method to generate a responsive background image using a Responsive Image Style.

Namespace

Drupal\responsive_background_image

Code

private static function createFallbackMediaQuery(string $css_selector, string $fallback_image_path) {
  return '
    ' . $css_selector . ' {
      background-image: url(' . $fallback_image_path . ');
    }';
}