You are here

public function ResponsiveImage::__toString in Image Lazyloader 8

File

src/ResponsiveImage.php, line 80

Class

ResponsiveImage
Class ResponsiveImage.

Namespace

Drupal\lazyloader

Code

public function __toString() {
  return implode(', ', array_map(function ($element) {
    $string_elements = [
      $element->uri,
    ];
    if (!empty($element->width)) {
      $string_elements[] = $element->width . 'w';
    }
    if (!empty($element->density)) {
      $string_elements[] = $element->density . 'x';
    }
    return implode(' ', $string_elements);
  }, $this->images));
}