From 00db73a8c19b4cc14cdbc7ec6c1d484348b8845f Mon Sep 17 00:00:00 2001 From: Alex Parsons Date: Fri, 8 Dec 2023 12:23:15 +0000 Subject: [PATCH] Add donate link to top bar --- classes/Renderer/User.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/classes/Renderer/User.php b/classes/Renderer/User.php index 4bff05315d..c4758f5f43 100644 --- a/classes/Renderer/User.php +++ b/classes/Renderer/User.php @@ -104,6 +104,7 @@ private function addLoggedInLinks() { ); $this->addContactLink(); + $this->addDonateLink(); } private function addLoggedOutLinks() { @@ -163,6 +164,7 @@ private function addLoggedOutLinks() { $this->addRepLinks(); $this->addContactLink(); + $this->addDonateLink(); } // add links to your MP etc if postcode set @@ -207,4 +209,22 @@ private function addContactLink() { ); } + private function addDonateLink() { + // In the long run, we should have a little page on this site and go through the normal metadata process + // for storing the link. + + if (LANGUAGE == 'cy') { + $text = 'Cyfrannwch'; + } else { + $text = 'Donate'; + } + + $this->data['user_nav_links'][] = array( + 'href' => "https://www.mysociety.org/donate?utm_source=theyworkforyou.com&utm_content=top-bar&utm_medium=link&utm_campaign=mysoc_header", + 'title' => $text, + 'classes' => '', + 'text' => $text + ); + } + }