Skip to content

Commit

Permalink
fix(publish): Fix changing sub elements not marking the section changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco (Valandur) committed Oct 10, 2018
1 parent abe62d2 commit 3c51ffe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/PageElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 3c51ffe

Please sign in to comment.