Final Class Yiisoft\Widget\WidgetFactoryInitializationException
| Inheritance | Yiisoft\Widget\WidgetFactoryInitializationException » RuntimeException |
|---|---|
| Implements | Yiisoft\FriendlyException\FriendlyExceptionInterface |
| Deprecated since version | Will be removed in version 3.0. |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getName() | Yiisoft\Widget\WidgetFactoryInitializationException | |
| getSolution() | Yiisoft\Widget\WidgetFactoryInitializationException |
Method Details
| public string getName ( ) |
public function getName(): string
{
return 'Failed to create a widget because WidgetFactory is not initialized.';
}
| public string|null getSolution ( ) |
public function getSolution(): ?string
{
return <<<'SOLUTION'
nitialize the widget factory call `WidgetFactory::initialize()` before using the widget.
s a good idea to do that for the whole application.
ple:
hp
var Psr\Container\ContainerInterface $container
oft\Widget\WidgetFactory::initialize(
container: $container,
definitions: [MyWidget::class => new MyWidget(/*...*/)],
themes: [
'custom' => [
MyWidget::class => [
'setValue()' => [42],
],
],
],
validate: true, // Whether definitions need to be validated.
Yii example in the configuration file of this package `config/bootstrap.php`.
TION;
}
Signup or Login in order to comment.