From a641ded9263541cca8f662e76a942d6fa50d6afb Mon Sep 17 00:00:00 2001 From: Patrick Nelson Date: Mon, 12 Oct 2015 17:23:01 -0400 Subject: [PATCH] FIX/NEW for #90 Extending alterDataList after both Versioned::get_by_stage() and also new DataList(). No list left behind! --- code/GoogleSitemap.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/GoogleSitemap.php b/code/GoogleSitemap.php index 97255fe..81b292d 100644 --- a/code/GoogleSitemap.php +++ b/code/GoogleSitemap.php @@ -204,7 +204,6 @@ class GoogleSitemap extends Object { if($class == "SiteTree") { $filter = ($filter) ? "\"ShowInSearch\" = 1" : ""; $instances = Versioned::get_by_stage('SiteTree', 'Live', $filter); - $this->extend("alterDataList", $instances, $class); } else if($class == "GoogleSitemapRoute") { $instances = array_slice(self::$routes, ($page - 1) * $count, $count); @@ -226,6 +225,8 @@ class GoogleSitemap extends Object { $instances = new DataList($class); } + $this->extend("alterDataList", $instances, $class); + $instances = $instances->limit( $count, ($page - 1) * $count @@ -341,7 +342,7 @@ class GoogleSitemap extends Object { foreach(self::$dataobjects as $class => $config) { $list = new DataList($class); $list = $list->sort('LastEdited ASC'); - + $this->extend("alterDataList", $list, $class); $neededForClass = ceil($list->count() / $countPerFile); for($i = 1; $i <= $neededForClass; $i++) {