From 2bf691f548444589ee995dcc1a752a0241e6bcdc Mon Sep 17 00:00:00 2001 From: kevin-hine-innis <83420315+kevin-hine-innis@users.noreply.github.com> Date: Tue, 28 Sep 2021 15:36:37 -0400 Subject: [PATCH] FIX ensure updateAnchorsOnPage extension is called (#2686) Currently, if there are no anchors found in the page content, the updateAnchorsOnPage extension is not called. This change will call the updateAnchorsOnPage extension regardless of the page content. --- code/Model/SiteTree.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/code/Model/SiteTree.php b/code/Model/SiteTree.php index d0be2288..56b0ee6a 100755 --- a/code/Model/SiteTree.php +++ b/code/Model/SiteTree.php @@ -3294,14 +3294,13 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi $matches ); - if (!$parseSuccess) { - return []; + $anchors = []; + if ($parseSuccess >= 1) { + $anchors = array_values(array_unique(array_filter( + array_merge($matches[3], $matches[5]) + ))); } - $anchors = array_values(array_unique(array_filter( - array_merge($matches[3], $matches[5]) - ))); - $this->extend('updateAnchorsOnPage', $anchors); return $anchors;