private addImageAttributes ( Contao\Image\PictureInterface $picture, array $attributes ) : Contao\Image\PictureInterface | ||
$picture | Contao\Image\PictureInterface | |
$attributes | array | |
Результат | Contao\Image\PictureInterface |
private function addImageAttributes(PictureInterface $picture, array $attributes)
{
if (empty($attributes)) {
return $picture;
}
$img = $picture->getImg();
foreach ($attributes as $attribute => $value) {
$img[$attribute] = $value;
}
$picture = new Picture($img, $picture->getSources());
return $picture;
}