Picture
class Picture extends Element (View source)
Properties
protected string | $element | Default element. |
|
protected bool | $isSelfClosing | Whether the element is self closing. |
|
protected string | $defaultChild | Default element for nested children. |
Methods
No description
Static alias for constructor.
Create the source elements for the picture element.
Create an img element wrapped in "". The image will be displayed if JavaScript is disabled.
Create the img element fallback for the picture element.
Set the image fallback and noscript image fallback "alt" attribute value.
Set the image fallback and noscript image fallback "title" attribute value.
Add one or more CSS classes to the image and noscript image fallback.
Set an attribute.
Details
__construct(array $sources = [], $fallbackSrc = '', $attributes = [], $lazyLoadNative = false, $lazyLoadJavaScript = false)
No description
static Picture
create(array $sources = [], string|null $fallbackSrc = false, array $attributes = [], bool|null $lazyLoadNative = false, bool|null $lazyLoadJavaScript = false)
Static alias for constructor.
Picture
sources(array $sources, bool $lazyLoadJavaScript = false)
Create the source elements for the picture element.
Example output:
Picture
noscriptFallback(string $src, bool $lazyLoadNative = false)
Create an img element wrapped in "". The image will be displayed if JavaScript is disabled.
Example output:
or
fallback(string $src, bool $lazyLoadNative = false, bool $lazyLoadJavaScript = false)
Create the img element fallback for the picture element.
Example output:
or
or
or
alt(string $alt)
Set the image fallback and noscript image fallback "alt" attribute value.
title(string $title)
Set the image fallback and noscript image fallback "title" attribute value.
addClass(string $classes)
Add one or more CSS classes to the image and noscript image fallback.
setAttribute(string $attribute, string|null $value = null)
Set an attribute.