Final Class Yiisoft\Yii\View\Renderer\Exception\InvalidMetaTagException
| Inheritance | Yiisoft\Yii\View\Renderer\Exception\InvalidMetaTagException » RuntimeException |
|---|---|
| Implements | Yiisoft\FriendlyException\FriendlyExceptionInterface |
InvalidMetaTagException is thrown if the meta tag is incorrectly configured during the injection.
Public Methods
Method Details
| public __construct( string $message, mixed $tag ): mixed | ||
| $message | string | |
| $tag | mixed | |
public function __construct(
string $message,
private readonly mixed $tag,
) {
parent::__construct($message);
}
| public getName( ): string |
public function getName(): string
{
return 'Invalid meta tag configuration in injection';
}
| public getSolution( ): string|null |
public function getSolution(): ?string
{
return 'Got meta tag:' . "\n" . var_export($this->tag, true) . <<<SOLUTION
njection that implements `Yiisoft\Yii\View\Renderer\MetaTagsInjectionInterface` defined meta tags in the method `getMetaTags()`.
meta tag can be define in the following ways:
array of attributes: `['name' => 'keywords', 'content' => 'yii,framework']`,
instance of `Yiisoft\Html\Tag\Meta`:
hp
::meta()
->name('keywords')
->content('yii,framework');
onally, you may use string keys of array as identifies the meta tag.
ple:
hp
ic function getMetaTags(): array
return [
'seo-keywords' => [
'name' => 'keywords',
'content' => 'yii,framework',
],
Html::meta()
->name('description')
->content('Yii is a fast, secure, and efficient PHP framework.'),
];
TION;
}
Signup or Login in order to comment.