From d3c4f381b462812380d43f0b0b505fec8b339574 Mon Sep 17 00:00:00 2001 From: Jeremy Shipman Date: Thu, 16 Oct 2014 15:56:51 +1300 Subject: [PATCH] FIX: don't customise the current controller to prevent variables conflicting with page controller / record variables/functions. fixes: #8 --- code/BetterNavigator.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/BetterNavigator.php b/code/BetterNavigator.php index 72e26a7..3401539 100755 --- a/code/BetterNavigator.php +++ b/code/BetterNavigator.php @@ -45,18 +45,17 @@ class BetterNavigator extends DataExtension { $isDeveloper = $member && is_array($devs) ? in_array($member->Email, $devs) : false; //Add other data for template - $nav = array_merge($nav, array( + $nav = new ArrayData(array_merge($nav, array( 'Member' => $member, 'Stage' => Versioned::current_stage(), 'LoginLink' => Config::inst()->get('Security', 'login_url'), '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 - $nav = new ArrayData($nav); - $page = $this->owner->customise($nav); - return $page->renderWith('BetterNavigator'); + return $nav->renderWith('BetterNavigator'); } } return false;