From 5c874e534749b1fe398605a59212c22e7548429e Mon Sep 17 00:00:00 2001 From: Jellygnite Date: Sat, 27 Mar 2021 11:12:35 +1000 Subject: [PATCH] ensure all elements use holder template from module folder --- _config/config.yml | 5 +++-- src/Extensions/BaseElementExtension.php | 6 ++++++ src/Extensions/ElementContentExtension.php | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/Extensions/ElementContentExtension.php diff --git a/_config/config.yml b/_config/config.yml index de8fd14..069d03b 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -10,7 +10,8 @@ DNADesign\Elemental\Models\BaseElement: Jellygnite\Elements\Model\BaseElementObject: extensions: - Jellygnite\ElementalStyle\Extensions\DynamicStyleExtension -DNADesign\Elemental\Models\ContentElement: - controller_class: Jellygnite\Elements\Controllers\CustomElementController +DNADesign\Elemental\Models\ElementContent: + extensions: + - Jellygnite\Elements\Extensions\ElementContentExtension diff --git a/src/Extensions/BaseElementExtension.php b/src/Extensions/BaseElementExtension.php index 7c12988..d0ac374 100644 --- a/src/Extensions/BaseElementExtension.php +++ b/src/Extensions/BaseElementExtension.php @@ -2,6 +2,7 @@ namespace Jellygnite\Elements\Extensions; +use Jellygnite\Elements\Controllers\CustomElementController; use Exception; use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\DataExtension; @@ -11,6 +12,11 @@ class BaseElementExtension extends DataExtension { + private static $controller_class = CustomElementController::class; // allows us to store templates in this module folder + + private static $controller_template = 'ElementHolder'; + + public function getNextElement(){ $element = BaseElement::get()->filter([ 'ParentID' => $this->owner->ParentID, diff --git a/src/Extensions/ElementContentExtension.php b/src/Extensions/ElementContentExtension.php new file mode 100644 index 0000000..dbafda7 --- /dev/null +++ b/src/Extensions/ElementContentExtension.php @@ -0,0 +1,17 @@ +