diff --git a/code/BetterNavigator.php b/code/BetterNavigator.php index 72e26a7..910eeeb 100755 --- a/code/BetterNavigator.php +++ b/code/BetterNavigator.php @@ -45,17 +45,19 @@ 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( + $backURL = '?BackURL=' . urlencode($this->owner->Link()); + $bNData = array_merge($nav, array( 'Member' => $member, 'Stage' => Versioned::current_stage(), - 'LoginLink' => Config::inst()->get('Security', 'login_url'), + 'LoginLink' => Config::inst()->get('Security', 'login_url') . $backURL, + 'LogoutLink' => 'Security/logout' . $backURL, 'Mode' => Director::get_environment_type(), 'IsDeveloper' => $isDeveloper )); //Merge with page data, send to template and render - $nav = new ArrayData($nav); - $page = $this->owner->customise($nav); + $bNData = new ArrayData($bNData); + $page = $this->owner->customise(array('BetterNavigator' => $bNData)); return $page->renderWith('BetterNavigator'); } } diff --git a/templates/BetterNavigator.ss b/templates/BetterNavigator.ss index d19fff0..7595399 100644 --- a/templates/BetterNavigator.ss +++ b/templates/BetterNavigator.ss @@ -5,58 +5,62 @@