Skip to content

Commit

Permalink
Close #2717 Update UAlert link in Global Footer (#3442)
Browse files Browse the repository at this point in the history
Co-authored-by: Dana Hertzberg <[email protected]>
Co-authored-by: Joe Parsons <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2024
1 parent e68d741 commit 7f53e65
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
33 changes: 33 additions & 0 deletions modules/custom/az_global_footer/az_global_footer.install
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,36 @@ function az_global_footer_update_1020801() {

return t('Updated %count X-Twitter link(s) & icon(s) in the global footer.', ['%count' => $updated_count]);
}

/**
* Update UAlert footer links.
*
* Replace UAlert links in the global footer with Annual Security Report.
*/
function az_global_footer_update_1020901() {
$updated_count = 0;
$menu_link_content_ids = \Drupal::entityQuery('menu_link_content')
->accessCheck(FALSE)
->condition('menu_name', 'az-footer-main')
->condition('title', 'UAlert')
->condition('link__uri', 'https://cirt.arizona.edu/ualert')
->execute();

foreach ($menu_link_content_ids as $id) {
/** @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link_content */
$menu_link_content = MenuLinkContent::load($id);
if ($menu_link_content !== NULL) {
// phpcs:disable
/* @phpstan-ignore-next-line */
$menu_link_content->title = 'Annual Security Report';
// phpcs:disable
/* @phpstan-ignore-next-line */
$menu_link_content->link->uri = 'https://clery.arizona.edu/annual-reports';
// phpcs:enable
$menu_link_content->save();
$updated_count++;
}
}

return t('Updated %count UAlert menu link(s) in the global footer.', ['%count' => $updated_count]);
}
4 changes: 2 additions & 2 deletions modules/custom/az_global_footer/data/az_global_footer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
"link_id": "5",
"parent_link_id": "0",
"menu": "az-footer-main",
"title": "UAlert",
"urlpath": "https://cirt.arizona.edu/ualert",
"title": "Annual Security Report",
"urlpath": "https://clery.arizona.edu/annual-reports",
"external": true,
"expanded": false,
"enabled": true,
Expand Down

0 comments on commit 7f53e65

Please sign in to comment.