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.
This commit is contained in:
kevin-hine-innis 2021-09-28 15:36:37 -04:00 committed by GitHub
parent f3a76ccf2d
commit 2bf691f548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -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;