mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-08 04:45:47 +00:00
Introduce CVA to html-extra
This commit is contained in:
committed by
Fabien Potencier
parent
21df1ad782
commit
e3ac14e1c8
@@ -37,6 +37,7 @@ final class HtmlExtension extends AbstractExtension
|
||||
{
|
||||
return [
|
||||
new TwigFunction('html_classes', [self::class, 'htmlClasses']),
|
||||
new TwigFunction('html_cva', [self::class, 'htmlCva']),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -110,4 +111,17 @@ final class HtmlExtension extends AbstractExtension
|
||||
|
||||
return implode(' ', array_unique(array_filter($classes, static function ($v) { return '' !== $v; })));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|list<string|null> $base
|
||||
* @param array<string, array<string, string|array<string>> $variants
|
||||
* @param array<array<string, string|array<string>>> $compoundVariants
|
||||
* @param array<string, string> $defaultVariant
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function htmlCva(array|string $base = [], array $variants = [], array $compoundVariants = [], array $defaultVariant = []): Cva
|
||||
{
|
||||
return new Cva($base, $variants, $compoundVariants, $defaultVariant);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user