FIX: don't customise the current controller to prevent variables conflicting with page controller / record variables/functions.

fixes: #8
This commit is contained in:
Jeremy Shipman 2014-10-16 15:56:51 +13:00
parent 3b53e7b36a
commit d3c4f381b4

View File

@ -45,18 +45,17 @@ class BetterNavigator extends DataExtension {
$isDeveloper = $member && is_array($devs) ? in_array($member->Email, $devs) : false; $isDeveloper = $member && is_array($devs) ? in_array($member->Email, $devs) : false;
//Add other data for template //Add other data for template
$nav = array_merge($nav, array( $nav = new ArrayData(array_merge($nav, array(
'Member' => $member, 'Member' => $member,
'Stage' => Versioned::current_stage(), 'Stage' => Versioned::current_stage(),
'LoginLink' => Config::inst()->get('Security', 'login_url'), 'LoginLink' => Config::inst()->get('Security', 'login_url'),
'Mode' => Director::get_environment_type(), 'Mode' => Director::get_environment_type(),
'IsDeveloper' => $isDeveloper 'IsDeveloper' => $isDeveloper,
)); 'ID' => $this->owner->ID,
'Link' => $this->owner->Link()
)));
//Merge with page data, send to template and render return $nav->renderWith('BetterNavigator');
$nav = new ArrayData($nav);
$page = $this->owner->customise($nav);
return $page->renderWith('BetterNavigator');
} }
} }
return false; return false;