Fix static exporter to export URLs properly

This commit is contained in:
☃ Stephen Shkardoon ☃ 2014-09-04 23:54:26 +12:00 committed by Stephen Shkardoon
parent 76ba1a8b25
commit e496341b70
1 changed files with 11 additions and 4 deletions

View File

@ -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);