Skip to content

Commit

Permalink
Move language switcher to rightmost position
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons authored and dracos committed Dec 15, 2023
1 parent 57ee306 commit 0f5314d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions classes/Renderer/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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() {
Expand Down Expand Up @@ -105,6 +108,7 @@ private function addLoggedInLinks() {

$this->addContactLink();
$this->addDonateLink();
$this->AddLangSwitcher();
}

private function addLoggedOutLinks() {
Expand Down Expand Up @@ -165,6 +169,7 @@ private function addLoggedOutLinks() {
$this->addRepLinks();
$this->addContactLink();
$this->addDonateLink();
$this->AddLangSwitcher();
}

// add links to your MP etc if postcode set
Expand Down

0 comments on commit 0f5314d

Please sign in to comment.