Skip to content

Commit

Permalink
Update helpers.php
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnathonKoster committed Oct 26, 2024
1 parent 3713222 commit bca301f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/View/Blade/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,31 @@

use Statamic\Fields\Value;
use Statamic\Fields\Values;
use Statamic\Modifiers\Modify;
use Statamic\Statamic;
use Statamic\Tags\FluentTag;

function value(mixed $value): mixed
{
if ($value instanceof Value) {
$value = $value->value();
} elseif ($value instanceof Values) {
$value = $value->all();
} elseif ($value instanceof FluentTag) {
return value($value->fetch());
} elseif ($value instanceof Modify) {
return value($value->fetch());
}

return $value;
}

function modify(mixed $value): Modify
{
return Statamic::modify($value);
}

function tag(string $name): FluentTag
{
return Statamic::tag($name);
}

0 comments on commit bca301f

Please sign in to comment.