Merge pull request #605 from getgrav/feature/modular-page-modified-date

The date for the last update of a page that is modular is the update time of the module that was last modified
This commit is contained in:
Flavio Copes
2016-01-15 13:19:51 +01:00
2 changed files with 12 additions and 0 deletions

View File

@@ -1424,6 +1424,7 @@ class Page
if ($var !== null) {
$this->modified = $var;
}
return $this->modified;
}

View File

@@ -820,6 +820,17 @@ class Pages
$page->routable(false);
}
// Override the modified time if modular
if ($page->template() == 'modular') {
foreach ($page->collection() as $child) {
$modified = $child->modified();
if ($modified > $last_modified) {
$last_modified = $modified;
}
}
}
// Override the modified and ID so that it takes the latest change into account
$page->modified($last_modified);
$page->id($last_modified.md5($page->filePath()));