diff --git a/src/Fields/BlueprintRepository.php b/src/Fields/BlueprintRepository.php index 05a76d5f108..2553dbc4448 100644 --- a/src/Fields/BlueprintRepository.php +++ b/src/Fields/BlueprintRepository.php @@ -8,6 +8,7 @@ use Statamic\Facades\File; use Statamic\Facades\Path; use Statamic\Facades\YAML; +use Statamic\Hooks\CP\Blueprint as BlueprintHook; use Statamic\Support\Arr; use Statamic\Support\Str; @@ -257,6 +258,9 @@ protected function filesIn($namespace) protected function makeBlueprintFromFile($path, $namespace = null) { + $hook = (new BlueprintHook())->makeFromFile($path, $namespace); + [$path, $namespace] = [$hook->path, $hook->namespace]; + return Blink::store(self::BLINK_FROM_FILE)->once($path, function () use ($path, $namespace) { if (! $namespace || ! isset($this->additionalNamespaces[$namespace])) { [$namespace, $handle] = $this->getNamespaceAndHandle( diff --git a/src/Hooks/CP/Blueprint.php b/src/Hooks/CP/Blueprint.php new file mode 100644 index 00000000000..ecf56f1338d --- /dev/null +++ b/src/Hooks/CP/Blueprint.php @@ -0,0 +1,20 @@ +runHooksWith('makeFromFile', [ + 'namespace' => $namespace, + 'path' => $path, + ]); + + return $payload; + } +}