diff --git a/modules/custom/az_core/az_core.links.menu.yml b/modules/custom/az_core/az_core.links.menu.yml index 1257466c51..3ed476467b 100644 --- a/modules/custom/az_core/az_core.links.menu.yml +++ b/modules/custom/az_core/az_core.links.menu.yml @@ -2,10 +2,31 @@ az_core.az_quickstart: route_name: az_core.az_quickstart parent: system.admin_config title: 'Arizona Quickstart' - description: 'Settings provided by Arizona Quickstart modules.' + description: 'Settings provided by Arizona Quickstart modules' az_core.az_settings: route_name: az_core.az_settings parent: az_core.az_quickstart title: 'Arizona Quickstart Settings' - description: 'Settings provided by Quickstart Core and various other Arizona Quickstart modules.' + description: 'Settings provided by Quickstart Core and various other Arizona Quickstart modules' + weight: 0 + +az_core.az_docs: + url: 'https://quickstart.arizona.edu' + parent: az_core.az_quickstart + title: 'Documentation' + description: 'Arizona Quickstart 2 Documentation' + options: + attributes: + target: '_blank' + weight: 2 + +az_core.az_releases: + url: 'https://github.com/az-digital/az_quickstart/releases' + parent: az_core.az_quickstart + title: 'Releases' + description: 'Arizona Quickstart 2 Releases' + options: + attributes: + target: '_blank' + weight: 1 diff --git a/modules/custom/az_google_tag/az_google_tag.module b/modules/custom/az_google_tag/az_google_tag.module index 20d649cd26..eb2ec432f2 100644 --- a/modules/custom/az_google_tag/az_google_tag.module +++ b/modules/custom/az_google_tag/az_google_tag.module @@ -12,15 +12,9 @@ use Drupal\Core\Url; */ function az_google_tag_toolbar_alter(&$items) { if (\Drupal::service('module_handler')->moduleExists('az_core')) { - $site_url = \Drupal::request()->getHost(); $items['az_quickstart']['tray']['az_links']['#links']['analytics'] = [ 'title' => t('Analytics Dashboard'), - 'url' => Url::fromUri('https://lookerstudio.google.com/reporting/ef02c272-afe4-4862-b4bd-8706e3436b2f/page/nbaTD', [ - 'query' => [ - 'params' => '{"df21":"include%EE%80%800%EE%80%80IN%EE%80%80' . $site_url . '"}', - ], - 'absolute' => TRUE, - ]), + 'url' => _az_google_tag_analytics_dashboard_url(), 'attributes' => [ 'title' => t('Site Analytics Dashboard'), 'target' => t('_blank'), @@ -29,6 +23,45 @@ function az_google_tag_toolbar_alter(&$items) { } } +/** + * Implements hook_menu_links_discovered_alter(). + */ +function az_google_tag_menu_links_discovered_alter(&$links) { + if (\Drupal::service('module_handler')->moduleExists('az_core')) { + $links['az_google_tag.analytics_dashboard'] = [ + 'title' => t('Analytics Dashboard'), + 'url' => _az_google_tag_analytics_dashboard_url()->toString(), + 'parent' => 'az_core.az_quickstart', + 'description' => t('Site Analytics Dashboard'), + 'options' => [ + 'attributes' => [ + 'title' => t('Site Analytics Dashboard'), + 'target' => t('_blank'), + ], + ], + ]; + } +} + +/** + * Returns analytics dashboard link info common to various render elements. + * + * @return \Drupal\Core\Url + * URL object for site-specific Analytics Dashboard URL. + */ +function _az_google_tag_analytics_dashboard_url() { + $site_url = \Drupal::request()->getHost(); + return Url::fromUri( + 'https://lookerstudio.google.com/reporting/ef02c272-afe4-4862-b4bd-8706e3436b2f/page/nbaTD', + [ + 'query' => [ + 'params' => '{"df21":"include%EE%80%800%EE%80%80IN%EE%80%80' . $site_url . '"}', + ], + 'absolute' => TRUE, + ] + ); +} + /** * Checks if the consent mode config setting is enabled for any Google Tags. *