0 follower

Final Class Yiisoft\Html\Tag\Tr

InheritanceYiisoft\Html\Tag\Tr » Yiisoft\Html\Tag\Base\NormalTag » Yiisoft\Html\Tag\Base\Tag
ImplementsYiisoft\Html\NoEncodeStringableInterface

Protected Properties

Hide inherited properties

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

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\Tr
$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;
}

            
addCells() public method

public addCells( Yiisoft\Html\Tag\Base\TableCellTag $cells ): self
$cells Yiisoft\Html\Tag\Base\TableCellTag

One or more cells.

                public function addCells(TableCellTag ...$cells): self
{
    $new = clone $this;
    $new->items = array_merge($new->items, $cells);
    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\Tr
$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;
}

            
addDataStrings() public method

public addDataStrings( string[] $strings, array $attributes = [], boolean $encode true ): self
$strings string[]

Array of data cells (Yiisoft\Html\Tag\Td) as strings.

$attributes array

The tag attributes in terms of name-value pairs.

$encode boolean

Whether to encode strings passed.

                public function addDataStrings(array $strings, array $attributes = [], bool $encode = true): self
{
    return $this->addCells(...$this->makeDataCells($strings, $attributes, $encode));
}

            
addHeaderStrings() public method

public addHeaderStrings( string[] $strings, array $attributes = [], boolean $encode true ): self
$strings string[]

Array of header cells (Yiisoft\Html\Tag\Th) as strings.

$attributes array

The tag attributes in terms of name-value pairs.

$encode boolean

Whether to encode strings passed.

                public function addHeaderStrings(array $strings, array $attributes = [], bool $encode = true): self
{
    return $this->addCells(...$this->makeHeaderCells($strings, $attributes, $encode));
}

            
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\Tr
$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;
}

            
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\Tr
$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\Tr
$attributes array

Name-value set of attributes.

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

            
before() protected method
protected before( ): string

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

            
cells() public method

public cells( Yiisoft\Html\Tag\Base\TableCellTag $cells ): self
$cells Yiisoft\Html\Tag\Base\TableCellTag

One or more cells.

                public function cells(TableCellTag ...$cells): self
{
    $new = clone $this;
    $new->items = $cells;
    return $new;
}

            
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\Tr
$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() . '>';
}

            
dataStrings() public method

public dataStrings( string[] $strings, array $attributes = [], boolean $encode true ): self
$strings string[]

Array of data cells (Yiisoft\Html\Tag\Td) as strings.

$attributes array

The tag attributes in terms of name-value pairs.

$encode boolean

Whether to encode strings passed.

                public function dataStrings(array $strings, array $attributes = [], bool $encode = true): self
{
    return $this->cells(...$this->makeDataCells($strings, $attributes, $encode));
}

            
generateContent() protected method

protected generateContent( ): string

                protected function generateContent(): string
{
    return $this->items
        ? "\n" . implode("\n", $this->items) . "\n"
        : '';
}

            
getName() protected method

protected getName( ): string

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

            
headerStrings() public method

public headerStrings( string[] $strings, array $attributes = [], boolean $encode true ): self
$strings string[]

Array of header cells (Yiisoft\Html\Tag\Th) as strings.

$attributes array

The tag attributes in terms of name-value pairs.

$encode boolean

Whether to encode strings passed.

                public function headerStrings(array $strings, array $attributes = [], bool $encode = true): self
{
    return $this->cells(...$this->makeHeaderCells($strings, $attributes, $encode));
}

            
id() public method

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

Set tag ID.

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

Tag ID.

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

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

Opening tag.

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

            
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\Tr
$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();
}

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

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

            
unionAttributes() public method

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

Union attributes with a new set.

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

Name-value set of attributes.

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