When converting values, it will be nice to allow backed enumeration.
Enumeration:
namespace App\Enums;
enum TableView: string
{
case CARD = 'card';
case TABLE = 'table';
}
Template:
<div {{ html_attr({'data-enum': enum('App\\Enums\\TableView').CARD}) }}>
Content
</div>
In htmlAttr function:
public static function htmlAttr(Environment $env, iterable|string|false|null ...$args): string
{
// ...
foreach ($attr as $name => $value) {
// ...
if ($value instanceof \BackedEnum) {
$value = $value.value;
}
// ...
}
}
Output:
<div data-enum="card">
Content
</div>
When converting values, it will be nice to allow backed enumeration.
Enumeration:
Template:
In
htmlAttrfunction:Output: