mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
FIX/NEW for #90 Extending alterDataList after both Versioned::get_by_stage() and also new DataList(). No list left behind!
This commit is contained in:
parent
e2a1dc5250
commit
a641ded926
@ -204,7 +204,6 @@ class GoogleSitemap extends Object {
|
|||||||
if($class == "SiteTree") {
|
if($class == "SiteTree") {
|
||||||
$filter = ($filter) ? "\"ShowInSearch\" = 1" : "";
|
$filter = ($filter) ? "\"ShowInSearch\" = 1" : "";
|
||||||
$instances = Versioned::get_by_stage('SiteTree', 'Live', $filter);
|
$instances = Versioned::get_by_stage('SiteTree', 'Live', $filter);
|
||||||
$this->extend("alterDataList", $instances, $class);
|
|
||||||
}
|
}
|
||||||
else if($class == "GoogleSitemapRoute") {
|
else if($class == "GoogleSitemapRoute") {
|
||||||
$instances = array_slice(self::$routes, ($page - 1) * $count, $count);
|
$instances = array_slice(self::$routes, ($page - 1) * $count, $count);
|
||||||
@ -226,6 +225,8 @@ class GoogleSitemap extends Object {
|
|||||||
$instances = new DataList($class);
|
$instances = new DataList($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->extend("alterDataList", $instances, $class);
|
||||||
|
|
||||||
$instances = $instances->limit(
|
$instances = $instances->limit(
|
||||||
$count,
|
$count,
|
||||||
($page - 1) * $count
|
($page - 1) * $count
|
||||||
@ -341,7 +342,7 @@ class GoogleSitemap extends Object {
|
|||||||
foreach(self::$dataobjects as $class => $config) {
|
foreach(self::$dataobjects as $class => $config) {
|
||||||
$list = new DataList($class);
|
$list = new DataList($class);
|
||||||
$list = $list->sort('LastEdited ASC');
|
$list = $list->sort('LastEdited ASC');
|
||||||
|
$this->extend("alterDataList", $list, $class);
|
||||||
$neededForClass = ceil($list->count() / $countPerFile);
|
$neededForClass = ceil($list->count() / $countPerFile);
|
||||||
|
|
||||||
for($i = 1; $i <= $neededForClass; $i++) {
|
for($i = 1; $i <= $neededForClass; $i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user