From e496341b70a3bd86bc9f792cece436ecc9a13499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=83=20Stephen=20Shkardoon=20=E2=98=83?= Date: Thu, 4 Sep 2014 23:54:26 +1200 Subject: [PATCH] Fix static exporter to export URLs properly --- code/controllers/StaticExporter.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/code/controllers/StaticExporter.php b/code/controllers/StaticExporter.php index 35d7822..d8d399f 100644 --- a/code/controllers/StaticExporter.php +++ b/code/controllers/StaticExporter.php @@ -47,7 +47,10 @@ class StaticExporter extends Controller { if(class_exists('SiteTree')) { if(!$this->config()->get('disable_sitetree_export')) { - $objs[] = $this->config()->export_objects; + $objs = $this->config()->export_objects; + if (!is_array($objs)) { + $objs = array($objs); + } if(!in_array('SiteTree', $objs)) { $objs[] = "SiteTree"; @@ -232,9 +235,13 @@ class StaticExporter extends Controller { $urls = array(); foreach($classes as $obj) { - $link = $obj->Link; - - $urls[$link] = $link; + if (!class_exists($obj)) { + continue; + } + foreach ($obj::get() as $objInstance) { + $link = $objInstance->Link(); + $urls[$link] = $link; + } } $this->extend('alterExportUrls', $urls);