0 follower

Final Class Yiisoft\Mailer\View\MessageBodyTemplate

InheritanceYiisoft\Mailer\View\MessageBodyTemplate

Stores the path to the view file directory and the layout view names.

Property Details

Hide inherited properties

$htmlLayout public property
public string|null $htmlLayout null
$textLayout public property
public string|null $textLayout null
$viewPath public property
public string $viewPath null

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( string $viewPath, string|null $htmlLayout null, string|null $textLayout null )
$viewPath string

The directory containing view files for composing mail messages.

$htmlLayout string|null

The HTML layout view name. It is the relative to {@see $viewPath} path to file with layout used to render HTML mail body, e.g., 'layouts/html'. If the value is null, no layout will be applied.

$textLayout string|null

The text layout view name. It is the relative to {@see $viewPath} path to file with layout used to render text mail body, e.g., 'layouts/text'. If the value is null, no layout will be applied.

                public function __construct(
    public readonly string $viewPath,
    public readonly string|null $htmlLayout = null,
    public readonly string|null $textLayout = null,
) {
    if ($viewPath === '') {
        throw new LogicException('View path must be non-empty string.');
    }
    if ($htmlLayout === '') {
        throw new LogicException('The HTML layout view name must be non-empty string or null.');
    }
    if ($textLayout === '') {
        throw new LogicException('The text layout view name must be non-empty string or null.');
    }
}