0 follower

Final Class Yiisoft\Yii\Bulma\Message

InheritanceYiisoft\Yii\Bulma\Message » Yiisoft\Widget\Widget

Message renders Bulma message component.

For example,

<?= Message::widget()
    ->headerColor('success')
    ->header('System info')
    ->body('Say hello...') ?>

Public Methods

Hide inherited methods

Method Description Defined By
attributes() Returns a new instance with the specified HTML attributes for widget. Yiisoft\Yii\Bulma\Message
autoIdPrefix() Returns a new instance with the specified prefix to the automatically generated widget IDs. Yiisoft\Yii\Bulma\Message
body() Returns a new instance with the specified the body content. Yiisoft\Yii\Bulma\Message
bodyAttributes() Returns a new instance with the specified HTML attributes for the widget body tag. Yiisoft\Yii\Bulma\Message
bodyCssClass() Returns a new instance with the specified the CSS class for the body container. Yiisoft\Yii\Bulma\Message
closeButtonAttributes() Returns a new instance with the specified HTML attributes for the close button tag. Yiisoft\Yii\Bulma\Message
encode() Returns a new instance with the specified whether the tags for the message are encoded. Yiisoft\Yii\Bulma\Message
headerAttributes() Returns a new instance with the specified HTML attributes for the widget header tag. Yiisoft\Yii\Bulma\Message
headerColor() Returns a new instance with the specified message header color. Yiisoft\Yii\Bulma\Message
headerMessage() Returns a new instance with the specified the header message. Yiisoft\Yii\Bulma\Message
id() Returns a new instance with the specified ID of the widget. Yiisoft\Yii\Bulma\Message
render() Yiisoft\Yii\Bulma\Message
size() Returns a new instance with the specified size for the widget. Yiisoft\Yii\Bulma\Message
withoutCloseButton() Returns a new instance with the specified allows you to remove the close button. Yiisoft\Yii\Bulma\Message
withoutHeader() Returns a new instance with the specified allows you to disable header. Yiisoft\Yii\Bulma\Message

Constants

Hide inherited constants

Constant Value Description Defined By
COLOR_ALL [ self::COLOR_PRIMARY, self::COLOR_LINK, self::COLOR_INFO, self::COLOR_SUCCESS, self::COLOR_WARNING, self::COLOR_DANGER, self::COLOR_DARK, ] Yiisoft\Yii\Bulma\Message
COLOR_DANGER 'is-danger' Yiisoft\Yii\Bulma\Message
COLOR_DARK 'is-dark' Yiisoft\Yii\Bulma\Message
COLOR_INFO 'is-info' Yiisoft\Yii\Bulma\Message
COLOR_PRIMARY 'is-primary' Yiisoft\Yii\Bulma\Message
COLOR_SUCCESS 'is-success' Yiisoft\Yii\Bulma\Message
COLOR_WARNING 'is-warning' Yiisoft\Yii\Bulma\Message
SIZE_ALL [ self::SIZE_SMALL, self::SIZE_MEDIUM, self::SIZE_LARGE, ] Yiisoft\Yii\Bulma\Message
SIZE_LARGE 'is-large' Yiisoft\Yii\Bulma\Message
SIZE_MEDIUM 'is-medium' Yiisoft\Yii\Bulma\Message
SIZE_SMALL 'is-small' Yiisoft\Yii\Bulma\Message

Method Details

Hide inherited methods

attributes() public method

Returns a new instance with the specified HTML attributes for widget.

public attributes( array $values ): self
$values array

Attribute values indexed by attribute names.

\Yiisoft\Html\Html::renderTagAttributes() For details on how attributes are being rendered.

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

            
autoIdPrefix() public method

Returns a new instance with the specified prefix to the automatically generated widget IDs.

public autoIdPrefix( string $value ): self
$value string

The prefix to the automatically generated widget IDs.

                public function autoIdPrefix(string $value): self
{
    $new = clone $this;
    $new->autoIdPrefix = $value;
    return $new;
}

            
body() public method

Returns a new instance with the specified the body content.

public body( string $value ): self
$value string

The body content.

                public function body(string $value): self
{
    $new = clone $this;
    $new->body = $value;
    return $new;
}

            
bodyAttributes() public method

Returns a new instance with the specified HTML attributes for the widget body tag.

public bodyAttributes( array $values ): self
$values array

Attribute values indexed by attribute names.

\Yiisoft\Html\Html::renderTagAttributes() for details on how attributes are being rendered.

                public function bodyAttributes(array $values): self
{
    $new = clone $this;
    $new->bodyAttributes = $values;
    return $new;
}

            
bodyCssClass() public method

Returns a new instance with the specified the CSS class for the body container.

public bodyCssClass( string $value ): self
$value string

The CSS class for the body container.

                public function bodyCssClass(string $value): self
{
    $new = clone $this;
    $new->bodyCssClass = $value;
    return $new;
}

            
closeButtonAttributes() public method

Returns a new instance with the specified HTML attributes for the close button tag.

The close button is displayed in the header of the Message. Clicking on the button will hide the message.

public closeButtonAttributes( array $values ): self
$values array

Attribute values indexed by attribute names.

\Yiisoft\Html\Html::renderTagAttributes() For details on how attributes are being rendered.

                public function closeButtonAttributes(array $values): self
{
    $new = clone $this;
    $new->closeButtonAttributes = $values;
    return $new;
}

            
encode() public method

Returns a new instance with the specified whether the tags for the message are encoded.

public encode( boolean $value ): self
$value boolean

Whether to encode the output.

                public function encode(bool $value): self
{
    $new = clone $this;
    $new->encode = $value;
    return $new;
}

            
headerAttributes() public method

Returns a new instance with the specified HTML attributes for the widget header tag.

public headerAttributes( array $values ): self
$values array

Attribute values indexed by attribute names.

\Yiisoft\Html\Html::renderTagAttributes() For details on how attributes are being rendered.

                public function headerAttributes(array $values): self
{
    $new = clone $this;
    $new->headerAttributes = $values;
    return $new;
}

            
headerColor() public method

Returns a new instance with the specified message header color.

public headerColor( string $value ): self
$value string

The header color. Default is Message::COLOR_DARK. Possible values: Message::COLOR_PRIMARY, Message::COLOR_LINK, Message::COLOR_INFO, Message::COLOR_SUCCESS, Message::COLOR_WARNING, Message::COLOR_DANGER, Message::COLOR_DARK.

                public function headerColor(string $value): self
{
    if (!in_array($value, self::COLOR_ALL, true)) {
        $values = implode('", "', self::COLOR_ALL);
        throw new InvalidArgumentException("Invalid color. Valid values are: \"$values\".");
    }
    $new = clone $this;
    $new->headerColor = $value;
    return $new;
}

            
headerMessage() public method

Returns a new instance with the specified the header message.

public headerMessage( string $value ): self
$value string

The header message.

                public function headerMessage(string $value): self
{
    $new = clone $this;
    $new->headerMessage = $value;
    return $new;
}

            
id() public method

Returns a new instance with the specified ID of the widget.

public id( string $value ): self
$value string

The ID of the widget.

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

            
render() public method

public render( ): string

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

            
size() public method

Returns a new instance with the specified size for the widget.

public size( string $value ): self
$value string

Size class. By default, not class is added and the size is considered "normal". Possible values: Message::SIZE_SMALL, Message::SIZE_MEDIUM, Message::SIZE_LARGE.

                public function size(string $value): self
{
    if (!in_array($value, self::SIZE_ALL, true)) {
        $values = implode('", "', self::SIZE_ALL);
        throw new InvalidArgumentException("Invalid size. Valid values are: \"$values\".");
    }
    $new = clone $this;
    $new->size = $value;
    return $new;
}

            
withoutCloseButton() public method

Returns a new instance with the specified allows you to remove the close button.

public withoutCloseButton( boolean $value ): self
$value boolean

Whether to remove the close button.

                public function withoutCloseButton(bool $value): self
{
    $new = clone $this;
    $new->closedButton = $value;
    return $new;
}

            
withoutHeader() public method

Returns a new instance with the specified allows you to disable header.

public withoutHeader( boolean $value ): self
$value boolean

Whether to disable header.

                public function withoutHeader(bool $value): self
{
    $new = clone $this;
    $new->withoutHeader = $value;
    return $new;
}