Skip to content
Snippets Groups Projects
Commit b06d49b8 authored by Eric Bremner's avatar Eric Bremner
Browse files

ISTWCMS-4923: adding function to check for inaccessible menu links

parent 27935d98
No related branches found
No related tags found
1 merge request!119Feature/istwcms 4923 ebremner inaccessible menu links
......@@ -677,6 +677,9 @@ class UWService implements UWServiceInterface {
// Ensure that we only get the published menu items.
$this->uwCheckPublishedMenuItems($menu);
// Remove inaccessible menu links.
$this->uwCheckMenuInaccessible($menu);
// If we want to have the count of menu items, then count them.
if ($count_menu_items) {
......@@ -726,6 +729,19 @@ class UWService implements UWServiceInterface {
}
}
/**
* {@inheritDoc}
*/
public function uwCheckMenuInaccessible(&$menu): void {
// Step through each menu and if it is inaccessible, remove it.
foreach ($menu as $key => $m) {
if ($m['text'] == 'Inaccessible') {
unset($menu[$key]);
}
}
}
/**
* {@inheritDoc}
*/
......
......@@ -196,6 +196,14 @@ interface UWServiceInterface {
*/
public function uwCheckPublishedMenuItems(array &$menu): void;
/**
* Function to check that all menu links are inaccessible.
*
* @param array $menu
* The array of menus.
*/
public function uwCheckMenuInaccessible(array &$menu): void;
/**
* A function to setup the menu for UW display.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment