Skip to content

Commit 5602397

Browse files
Julian ThomsonJulian Thomson
authored andcommitted
Redirector page gets this extension via its (content) controller but can never have elemental
1 parent 19c71f1 commit 5602397

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Extension/VirtualElementContentControllerExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace DNADesign\ElementalVirtual\Extensions;
44

55
use DNADesign\Elemental\Models\BaseElement;
6+
use SilverStripe\CMS\Model\RedirectorPageController;
67
use SilverStripe\Core\Extension;
78

89
class VirtualElementalContentControllerExtension extends Extension
@@ -28,6 +29,11 @@ public function handleElement()
2829
if ($element && $element->canView()) {
2930
$useElement = clone $element;
3031

32+
// Don't allow this to be used on a RedirectorPage
33+
if ($this->owner instanceof RedirectorPageController) {
34+
return null;
35+
}
36+
3137
// modify the element to appear on the correct 'Page' so that
3238
// any breadcrumbs and titles are correct.
3339
$elementalAreaRelations = $this->owner->getElementalRelations();

0 commit comments

Comments
 (0)