0 follower

Final Class Yiisoft\Html\Tag\Video

InheritanceYiisoft\Html\Tag\Video » Yiisoft\Html\Tag\Base\MediaTag » Yiisoft\Html\Tag\Base\NormalTag » Yiisoft\Html\Tag\Base\Tag
ImplementsYiisoft\Html\NoEncodeStringableInterface
Uses TraitsYiisoft\Html\Tag\Base\TagSourcesTrait

Protected Properties

Hide inherited properties

Property Type Description Defined By
$attributes array Yiisoft\Html\Tag\Base\Tag

Public Methods

Hide inherited methods

Method Description Defined By
__toString() Yiisoft\Html\Tag\Base\Tag
addAttributes() Add a set of attributes to existing tag attributes. Yiisoft\Html\Tag\Base\Tag
addClass() Add one or more CSS classes to the tag. Yiisoft\Html\Tag\Base\Tag
addSource() Yiisoft\Html\Tag\Base\TagSourcesTrait
addStyle() Add CSS styles to the tag. Yiisoft\Html\Tag\Base\Tag
addTrack() Yiisoft\Html\Tag\Base\MediaTag
attribute() Set attribute value. Yiisoft\Html\Tag\Base\Tag
attributes() Replace attributes with a new set. Yiisoft\Html\Tag\Base\Tag
autoplay() Yiisoft\Html\Tag\Base\MediaTag
class() Replace current tag CSS classes with a new set of classes. Yiisoft\Html\Tag\Base\Tag
close() Yiisoft\Html\Tag\Base\NormalTag
controls() Yiisoft\Html\Tag\Base\MediaTag
crossOrigin() Yiisoft\Html\Tag\Base\MediaTag
fallback() Content for browser that doesn't support media tags. Yiisoft\Html\Tag\Base\MediaTag
height() Yiisoft\Html\Tag\Video
id() Set tag ID. Yiisoft\Html\Tag\Base\Tag
loop() Yiisoft\Html\Tag\Base\MediaTag
muted() Yiisoft\Html\Tag\Base\MediaTag
open() Yiisoft\Html\Tag\Base\NormalTag
poster() Yiisoft\Html\Tag\Video
preload() Yiisoft\Html\Tag\Base\MediaTag
removeStyle() Remove CSS styles from the tag. Yiisoft\Html\Tag\Base\Tag
render() Yiisoft\Html\Tag\Base\Tag
sources() Yiisoft\Html\Tag\Base\TagSourcesTrait
src() Yiisoft\Html\Tag\Base\MediaTag
tag() Yiisoft\Html\Tag\Base\NormalTag
tracks() Yiisoft\Html\Tag\Base\MediaTag
unionAttributes() Union attributes with a new set. Yiisoft\Html\Tag\Base\Tag
width() Yiisoft\Html\Tag\Video

Constants

Hide inherited constants

Constant Value Description Defined By
CROSSORIGIN_ANONYMOUS 'anonymous' Yiisoft\Html\Tag\Base\MediaTag
CROSSORIGIN_CREDENTIALS 'use-credentials' Yiisoft\Html\Tag\Base\MediaTag
PRELOAD_AUTO 'auto' Yiisoft\Html\Tag\Base\MediaTag
PRELOAD_METADATA 'metadata' Yiisoft\Html\Tag\Base\MediaTag
PRELOAD_NONE 'none' Yiisoft\Html\Tag\Base\MediaTag

Method Details

Hide inherited methods

__toString() public method
public __toString( ): string

                final public function __toString(): string
{
    return $this->render();
}

            
addAttributes() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::addAttributes()

Add a set of attributes to existing tag attributes.

Same named attributes are replaced.

public addAttributes( array $attributes ): Yiisoft\Html\Tag\Video
$attributes array

Name-value set of attributes.

                final public function addAttributes(array $attributes): static
{
    $new = clone $this;
    $new->attributes = array_merge($new->attributes, $attributes);
    return $new;
}

            
addClass() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::addClass()

Add one or more CSS classes to the tag.

public addClass( \BackedEnum|string|null $class ): Yiisoft\Html\Tag\Video
$class \BackedEnum|string|null

One or many CSS classes.

                final public function addClass(BackedEnum|string|null ...$class): static
{
    $new = clone $this;
    Html::addCssClass($new->attributes, $class);
    return $new;
}

            
addSource() public method
public addSource( Yiisoft\Html\Tag\Source $source ): Yiisoft\Html\Tag\Video
$source Yiisoft\Html\Tag\Source

                public function addSource(Source $source): static
{
    $new = clone $this;
    $new->sources[] = $source;
    return $new;
}

            
addStyle() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::addStyle()

Add CSS styles to the tag.

See also Yiisoft\Html\Html::addCssStyle().

public addStyle( string|string[] $style, boolean $overwrite true ): Yiisoft\Html\Tag\Video
$style string|string[]

The new style string (e.g. 'width: 100px; height: 200px') or array (e.g. ['width' => '100px', 'height' => '200px']).

$overwrite boolean

Whether to overwrite existing CSS properties if the new style contain them too.

                final public function addStyle(array|string $style, bool $overwrite = true): static
{
    $new = clone $this;
    Html::addCssStyle($new->attributes, $style, $overwrite);
    return $new;
}

            
addTrack() public method
public addTrack( Yiisoft\Html\Tag\Track $track ): Yiisoft\Html\Tag\Video
$track Yiisoft\Html\Tag\Track

                final public function addTrack(Track $track): static
{
    $new = clone $this;
    $new->tracks[] = $track;
    return $new;
}

            
after() protected method
protected after( ): string

                protected function after(): string
{
    return '';
}

            
attribute() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::attribute()

Set attribute value.

public attribute( string $name, mixed $value ): Yiisoft\Html\Tag\Video
$name string

Name of the attribute.

$value mixed

Value of the attribute.

                final public function attribute(string $name, mixed $value): static
{
    $new = clone $this;
    $new->attributes[$name] = $value;
    return $new;
}

            
attributes() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::attributes()

Replace attributes with a new set.

public attributes( array $attributes ): Yiisoft\Html\Tag\Video
$attributes array

Name-value set of attributes.

                final public function attributes(array $attributes): static
{
    $new = clone $this;
    $new->attributes = $attributes;
    return $new;
}

            
autoplay() public method
public autoplay( boolean $autoplay true ): Yiisoft\Html\Tag\Video
$autoplay boolean

                final public function autoplay(bool $autoplay = true): static
{
    return $this->attribute('autoplay', $autoplay);
}

            
before() protected method
protected before( ): string

                protected function before(): string
{
    return '';
}

            
class() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::class()

Replace current tag CSS classes with a new set of classes.

public class( \BackedEnum|string|null $class ): Yiisoft\Html\Tag\Video
$class \BackedEnum|string|null

One or many CSS classes.

                final public function class(BackedEnum|string|null ...$class): static
{
    $new = clone $this;
    unset($new->attributes['class']);
    Html::addCssClass($new->attributes, $class);
    return $new;
}

            
close() public method
public close( ): string
return string

Closing tag.

                final public function close(): string
{
    return '</' . $this->getName() . '>';
}

            
controls() public method
public controls( boolean $controls true ): Yiisoft\Html\Tag\Video
$controls boolean

                final public function controls(bool $controls = true): static
{
    return $this->attribute('controls', $controls);
}

            
crossOrigin() public method
public crossOrigin( string|null $value ): Yiisoft\Html\Tag\Video
$value string|null

                final public function crossOrigin(?string $value): static
{
    return $this->attribute('crossorigin', $value);
}

            
fallback() public method

Defined in: Yiisoft\Html\Tag\Base\MediaTag::fallback()

Content for browser that doesn't support media tags.

public fallback( string|\Stringable|null $fallback ): Yiisoft\Html\Tag\Video
$fallback string|\Stringable|null

                final public function fallback(string|Stringable|null $fallback): static
{
    $new = clone $this;
    $new->fallback = $fallback === null ? null : (string) $fallback;
    return $new;
}

            
generateContent() protected method
protected generateContent( ): string

                final protected function generateContent(): string
{
    $items = $this->sources;
    $hasDefaultTrack = false;
    foreach ($this->tracks as $track) {
        $isDefault = $track->isDefault();
        if ($hasDefaultTrack && $isDefault) {
            $items[] = $track->default(false);
        } else {
            $items[] = $track;
            if (!$hasDefaultTrack) {
                $hasDefaultTrack = $isDefault;
            }
        }
    }
    if ($this->fallback) {
        $items[] = $this->fallback;
    }
    return $items ? "\n" . implode("\n", $items) . "\n" : '';
}

            
getName() protected method

protected getName( ): string

                protected function getName(): string
{
    return 'video';
}

            
height() public method

public height( integer|string|null $height ): self
$height integer|string|null

                public function height(int|string|null $height): self
{
    return $this->attribute('height', $height);
}

            
id() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::id()

Set tag ID.

public id( string|null $id ): Yiisoft\Html\Tag\Video
$id string|null

Tag ID.

                final public function id(?string $id): static
{
    $new = clone $this;
    $new->attributes['id'] = $id;
    return $new;
}

            
loop() public method
public loop( boolean $loop true ): Yiisoft\Html\Tag\Video
$loop boolean

                final public function loop(bool $loop = true): static
{
    return $this->attribute('loop', $loop);
}

            
muted() public method
public muted( boolean $muted true ): Yiisoft\Html\Tag\Video
$muted boolean

                final public function muted(bool $muted = true): static
{
    return $this->attribute('muted', $muted);
}

            
open() public method
public open( ): string
return string

Opening tag.

                final public function open(): string
{
    return '<' . $this->getName() . $this->renderAttributes() . '>' . $this->prepend();
}

            
poster() public method

public poster( string|null $poster ): self
$poster string|null

                public function poster(?string $poster): self
{
    return $this->attribute('poster', $poster);
}

            
preload() public method
public preload( string|null $preload ): Yiisoft\Html\Tag\Video
$preload string|null

                final public function preload(?string $preload): static
{
    return $this->attribute('preload', $preload);
}

            
prepareAttributes() protected method
protected prepareAttributes( ): void

                protected function prepareAttributes(): void {}

            
prepend() protected method
protected prepend( ): string

                protected function prepend(): string
{
    return '';
}

            
removeStyle() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::removeStyle()

Remove CSS styles from the tag.

See also Yiisoft\Html\Html::removeCssStyle().

public removeStyle( string|string[] $properties ): Yiisoft\Html\Tag\Video
$properties string|string[]

The CSS properties to be removed. You may use a string if you are removing a single property.

                final public function removeStyle(string|array $properties): static
{
    $new = clone $this;
    Html::removeCssStyle($new->attributes, $properties);
    return $new;
}

            
render() public method
public render( ): string

                final public function render(): string
{
    return $this->before() . $this->renderTag() . $this->after();
}

            
renderAttributes() protected method

Defined in: Yiisoft\Html\Tag\Base\Tag::renderAttributes()

Render the current tag attributes.

See also Yiisoft\Html\Html::renderTagAttributes().

protected renderAttributes( ): string

                final protected function renderAttributes(): string
{
    $this->prepareAttributes();
    return Html::renderTagAttributes($this->attributes);
}

            
renderTag() protected method
protected renderTag( ): string

                final protected function renderTag(): string
{
    return $this->open() . $this->generateContent() . $this->close();
}

            
sources() public method
public sources( Yiisoft\Html\Tag\Source $sources ): Yiisoft\Html\Tag\Video
$sources Yiisoft\Html\Tag\Source

                public function sources(Source ...$sources): static
{
    $new = clone $this;
    $new->sources = $sources;
    return $new;
}

            
src() public method
public src( string|null $src ): Yiisoft\Html\Tag\Video
$src string|null

                final public function src(?string $src): static
{
    return $this->attribute('src', $src);
}

            
tag() public static method
public static tag( ): Yiisoft\Html\Tag\Video

                final public static function tag(): static
{
    return new static();
}

            
tracks() public method
public tracks( Yiisoft\Html\Tag\Track $tracks ): Yiisoft\Html\Tag\Video
$tracks Yiisoft\Html\Tag\Track

                final public function tracks(Track ...$tracks): static
{
    $new = clone $this;
    $new->tracks = $tracks;
    return $new;
}

            
unionAttributes() public method

Defined in: Yiisoft\Html\Tag\Base\Tag::unionAttributes()

Union attributes with a new set.

public unionAttributes( array $attributes ): Yiisoft\Html\Tag\Video
$attributes array

Name-value set of attributes.

                final public function unionAttributes(array $attributes): static
{
    $new = clone $this;
    $new->attributes += $attributes;
    return $new;
}

            
width() public method

public width( integer|string|null $width ): self
$width integer|string|null

                public function width(int|string|null $width): self
{
    return $this->attribute('width', $width);
}