From 74e378fd6512ada21601d33ea50a6aeb2edd1ef2 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Fri, 16 Sep 2022 10:26:23 -0400 Subject: [PATCH] ISTWCMS-5754: fixing link url if route name on csv menu report --- src/Controller/UwDownloadCsvController.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Controller/UwDownloadCsvController.php b/src/Controller/UwDownloadCsvController.php index 76f540b9..ef1b5d7d 100644 --- a/src/Controller/UwDownloadCsvController.php +++ b/src/Controller/UwDownloadCsvController.php @@ -184,7 +184,7 @@ class UwDownloadCsvController extends ControllerBase { // The menus to be used. $menu_names = [ 'main', - 'menu-audience-menu', + 'uw-menu-audience-menu', ]; // The header. @@ -268,7 +268,19 @@ class UwDownloadCsvController extends ControllerBase { $alias = Url::fromUri($link_url)->toString(); } else { - $link_url = $link->url; + + // If there is no url and there ius a route name, + // use the route name as the url. If there is + // a url just use the url. + if (!$link->url && $link->route_name) { + $link_url = $link->route_name; + } + else { + $link_url = $link->url; + } + + // Just give the alias a null value, since if we + // get to here there will be no alias. $alias = NULL; } @@ -309,7 +321,7 @@ class UwDownloadCsvController extends ControllerBase { 'parent_link_id' => $parent_id, 'alias' => $alias, 'link_path' => $link_url, - 'title' => unserialize($link->title), + 'title' => '"' . unserialize($link->title) . '"', 'has_children' => $link->has_children, 'p1' => $link->p1, 'p2' => $link->p2, -- GitLab