Final Class Yiisoft\Form\Theme\ThemeContainer
| Inheritance | Yiisoft\Form\Theme\ThemeContainer |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getTheme() | Yiisoft\Form\Theme\ThemeContainer | |
| initialize() | Yiisoft\Form\Theme\ThemeContainer |
Method Details
| public static Yiisoft\Form\Theme\Theme|null getTheme ( string|null $name = null ) | ||
| $name | string|null | |
public static function getTheme(?string $name = null): ?Theme
{
$name ??= self::$defaultConfig;
if ($name === null) {
return null;
}
if (!array_key_exists($name, self::$themes)) {
/** @psalm-suppress MixedArgument */
self::$themes[$name] = array_key_exists($name, self::$configs)
? new Theme(...self::$configs[$name])
: null;
}
return self::$themes[$name];
}
| public static void initialize ( array<string, array> $configs = [], string|null $defaultConfig = null ) | ||
| $configs | array<string, array> |
Array of configurations with {@see \Yiisoft\Form\Theme\Theme::__construct()}
arguments indexed by name. For example:
]
|
| $defaultConfig | string|null |
Configuration name that will be used for create fields by default. |
public static function initialize(array $configs = [], ?string $defaultConfig = null): void
{
self::$configs = $configs;
self::$defaultConfig = $defaultConfig;
self::$themes = [];
}
Signup or Login in order to comment.