Skip to content

Commit

Permalink
BUG Fix home page blank on preview
Browse files Browse the repository at this point in the history
Fixes #58
  • Loading branch information
Damian Mooyman committed Jul 20, 2016
1 parent 7c844d1 commit ec421f8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions code/controllers/ShareDraftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ public function preview(SS_HTTPRequest $request)
Session::set('unsecuredDraftSite', true);
Versioned::reading_stage('Stage');

// Create mock request; Simplify request to single top level reqest
// Hack to get around ContentController::init() redirecting on home page
$_FILES = array(array());

// Create mock request; Simplify request to single top level request
$pageRequest = new SS_HTTPRequest('GET', $page->URLSegment);
$pageRequest->match('$URLSegment//$Action/$ID/$OtherID', true);
$rendered = $controller->handleRequest($pageRequest, $this->model);
Expand Down Expand Up @@ -110,14 +113,6 @@ protected function errorPage()
*/
protected function getControllerFor($page)
{
$config = Config::inst()->forClass('ShareDraftController');

$controller = $config->controller;

if (!$controller || !class_exists($controller)) {
return new ContentController($page);
}

return new $controller($page);
return ModelAsController::controller_for($page);
}
}

0 comments on commit ec421f8

Please sign in to comment.