From a19a770cccc1ab5e60306f941158509e6793ba6b Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Fri, 8 Dec 2023 12:23:31 +0000 Subject: [PATCH] Move language switcher to rightmost position --- classes/Renderer/User.php | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/classes/Renderer/User.php b/classes/Renderer/User.php index c4758f5f43..3f25b60fef 100644 --- a/classes/Renderer/User.php +++ b/classes/Renderer/User.php @@ -27,6 +27,21 @@ public function __construct() { private function setupNavLinks() { $this->data['user_nav_links'] = array(); + + // We may want to send the user back to this current page after they've + // joined, logged out or logged in. So we put the URL in $returl. + $URL = new \MySociety\TheyWorkForYou\Url($this->page); + $this->returl = $URL->generate('none'); + + //user logged in + if ($this->user->isloggedin()) { + $this->addLoggedInLinks(); + } else { + $this->addLoggedOutLinks(); + } + } + + private function AddLangSwitcher(){ if (preg_match('#^(senedd|wales|ms(?!p))#', $this->page)) { $href = $_SERVER['REQUEST_URI']; if (LANGUAGE == 'cy') { @@ -47,18 +62,6 @@ private function setupNavLinks() { 'text' => $text, ); } - - // We may want to send the user back to this current page after they've - // joined, logged out or logged in. So we put the URL in $returl. - $URL = new \MySociety\TheyWorkForYou\Url($this->page); - $this->returl = $URL->generate('none'); - - //user logged in - if ($this->user->isloggedin()) { - $this->addLoggedInLinks(); - } else { - $this->addLoggedOutLinks(); - } } private function addLoggedInLinks() { @@ -105,6 +108,7 @@ private function addLoggedInLinks() { $this->addContactLink(); $this->addDonateLink(); + $this->AddLangSwitcher(); } private function addLoggedOutLinks() { @@ -165,6 +169,7 @@ private function addLoggedOutLinks() { $this->addRepLinks(); $this->addContactLink(); $this->addDonateLink(); + $this->AddLangSwitcher(); } // add links to your MP etc if postcode set