From 3c51ffe7853abbbc6a53523c584754246f15d5b3 Mon Sep 17 00:00:00 2001 From: "Marco (Valandur)" Date: Wed, 10 Oct 2018 14:37:58 +0200 Subject: [PATCH] fix(publish): Fix changing sub elements not marking the section changed --- src/PageElement.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PageElement.php b/src/PageElement.php index eb9386d..75a3a78 100755 --- a/src/PageElement.php +++ b/src/PageElement.php @@ -131,6 +131,12 @@ public function onBeforeWrite() { parent::onBeforeWrite(); + // If a field changed then update the counter, unless it's the counter that changed + $changed = $this->getChangedFields(true, DataObject::CHANGE_VALUE); + if (count($changed) > 0 && (!isset($changed["__Counter"]) || $changed["__Counter"]["level"] <= 1)) { + $this->__Counter++; + } + $elems = $this->Children()->Sort("SortOrder")->Column("ID"); $count = count($elems); for ($i = 0; $i < $count; $i++) {