Skip to content

Commit

Permalink
FIX Ignore content generation Requirements calls
Browse files Browse the repository at this point in the history
If an element declares some Requirements during its rendering, these
requirements get bound to the ajax request during a 'save' call from the
cms, and can then filter through to the CMS UI. This clears out any added
during the Content population process
  • Loading branch information
Marcus Nyeholt committed May 30, 2016
1 parent 7c2267e commit 6e7f760
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions code/extensions/ElementPageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function onBeforeWrite()
// Copy widgets content to Content to enable search
$searchableContent = array();

Requirements::clear();
foreach ($elements->Elements() as $element) {
if ($element->config()->exclude_from_content) {
continue;
Expand All @@ -151,6 +152,7 @@ public function onBeforeWrite()
array_push($searchableContent, $controller->WidgetHolder());
}
}
Requirements::restore();

$this->owner->Content = trim(implode(' ', $searchableContent));
}
Expand Down

0 comments on commit 6e7f760

Please sign in to comment.