public function ResponsiveImageStyle::addImageStyleMapping in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/responsive_image/src/Entity/ResponsiveImageStyle.php \Drupal\responsive_image\Entity\ResponsiveImageStyle::addImageStyleMapping()
Adds a image style mapping to the responsive image configuration entity.
Parameters
string $breakpoint_id: The breakpoint ID.
string $multiplier: The multiplier.
array $image_style_mapping: The mapping image style mapping.
Return value
$this
Overrides ResponsiveImageStyleInterface::addImageStyleMapping
File
- core/
modules/ responsive_image/ src/ Entity/ ResponsiveImageStyle.php, line 107 - Contains \Drupal\responsive_image\Entity\ResponsiveImageStyle.
Class
- ResponsiveImageStyle
- Defines the responsive image style entity.
Namespace
Drupal\responsive_image\EntityCode
public function addImageStyleMapping($breakpoint_id, $multiplier, array $image_style_mapping) {
// If there is an existing mapping, overwrite it.
foreach ($this->image_style_mappings as &$mapping) {
if ($mapping['breakpoint_id'] === $breakpoint_id && $mapping['multiplier'] === $multiplier) {
$mapping = array(
'breakpoint_id' => $breakpoint_id,
'multiplier' => $multiplier,
) + $image_style_mapping;
$this->keyedImageStyleMappings = NULL;
return $this;
}
}
$this->image_style_mappings[] = array(
'breakpoint_id' => $breakpoint_id,
'multiplier' => $multiplier,
) + $image_style_mapping;
$this->keyedImageStyleMappings = NULL;
return $this;
}