From 790dbd381d0df54e7af34ecb2a2edacdb47614f5 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Mon, 21 Sep 2020 23:20:44 +0300 Subject: [PATCH] Added missing `onBlueprintCreated` event for Flex Pages --- CHANGELOG.md | 1 + system/src/Grav/Common/Flex/Types/Pages/PageObject.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f234283e3..77c587570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Fixed `Security::sanitizeSVG()` creating an empty file if SVG file cannot be parsed * Fixed infinite loop in blueprints with `extend@` to a parent stream * Added missing `Stream::create()` method + * Added missing `onBlueprintCreated` event for Flex Pages # v1.7.0-rc.16 ## 09/01/2020 diff --git a/system/src/Grav/Common/Flex/Types/Pages/PageObject.php b/system/src/Grav/Common/Flex/Types/Pages/PageObject.php index 3249ddcca..351af145f 100644 --- a/system/src/Grav/Common/Flex/Types/Pages/PageObject.php +++ b/system/src/Grav/Common/Flex/Types/Pages/PageObject.php @@ -422,6 +422,11 @@ class PageObject extends FlexPageObject $blueprint = $this->getFlexDirectory()->getBlueprint($template, 'blueprints://pages'); } + if ($name === '') { + // Support onBlueprintCreated event just like in Pages::blueprints($template) + Grav::instance()->fireEvent('onBlueprintCreated', new Event(['blueprint' => $blueprint, 'type' => $template])); + } + return $blueprint; }