Skip to content

Commit 4b9a678

Browse files
ASU-1716: complete to hide menu items
1 parent 8df579b commit 4b9a678

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

public/modules/custom/asu_apartment_search/asu_apartment_search.module

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Contains asu apartment search module.
66
*/
77

8+
use Drupal\menu_link_content\Entity\MenuLinkContent;
89
/**
910
* Implements hook_theme().
1011
*/
@@ -31,3 +32,19 @@ function asu_apartment_search_theme() {
3132
],
3233
];
3334
}
35+
36+
37+
function asu_apartment_search_entity_load(array &$entities, string $entity_type) {
38+
if ($entity_type === 'menu_link_content') {
39+
foreach ($entities as $entity) {
40+
$disabled_routes = [
41+
'route:asu_apartment_search.haso_upcoming',
42+
'route:asu_apartment_search.hitas_upcoming',
43+
];
44+
45+
if (in_array($entity->get('link')->uri, $disabled_routes)) {
46+
$entity->delete();
47+
}
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)