Skip to content

Commit

Permalink
Fix static exporter to export URLs properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ss23 authored and Stephen Shkardoon committed Jan 8, 2015
1 parent 76ba1a8 commit e496341
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions code/controllers/StaticExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public function __construct() {

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";
Expand Down Expand Up @@ -232,9 +235,13 @@ public function getExportUrls() {
$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);
Expand Down

0 comments on commit e496341

Please sign in to comment.