diff --git a/src/Fields/FieldsetRepository.php b/src/Fields/FieldsetRepository.php index 3888ee40..64e8af47 100644 --- a/src/Fields/FieldsetRepository.php +++ b/src/Fields/FieldsetRepository.php @@ -6,6 +6,7 @@ use Statamic\Facades\Blink; use Statamic\Fields\Fieldset; use Statamic\Fields\FieldsetRepository as StacheRepository; +use Statamic\Support\Str; class FieldsetRepository extends StacheRepository { @@ -18,8 +19,14 @@ public function all(): Collection return $models->map(function ($model) { return Blink::once("eloquent-fieldset-{$model->handle}", function () use ($model) { + $handle = $model->handle; + + if (Str::startsWith($handle, 'vendor.')) { + $handle = Str::of($handle)->after('vendor.')->replaceFirst('.', '::'); + } + return (new Fieldset) - ->setHandle($model->handle) + ->setHandle($handle) ->setContents($model->data); }); }); @@ -30,6 +37,10 @@ public function find($handle): ?Fieldset { $handle = str_replace('/', '.', $handle); + if (Str::startsWith($handle, 'vendor.')) { + $handle = Str::of($handle)->after('vendor.')->replaceFirst('.', '::'); + } + return $this->all()->filter(function ($fieldset) use ($handle) { return $fieldset->handle() == $handle; })->first();