Open Mikhail-Kalinin2 opened 1 year ago
Hello, @kongondo!
I use the module in this way: I'm creating a site with possibility of creating blank menu without items.
On these lines I'm trying to get menu items:
$menuBuilder = $this->modules->get('MarkupMenuBuilder'); $this->menuItems = $menuBuilder->getMenuItems($id);
Then I get an error: "No menu items found! Confirm that such a menu exists and that it has menu items." if items are not present. This is caused by the line 1366:
https://github.com/kongondo/MenuBuilder/blob/main/MarkupMenuBuilder.module#L1366
I tried to fix it manually using the fact that the menu is a page and menu items are being stored in menu_items variable:
$menuBuilder = $this->modules->get('MarkupMenuBuilder'); $menu = $this->pages->get($id); if($menu->menu_items) { $this->menuItems = $menuBuilder->getMenuItems($id); } else { return; }
However, it seems to be only a workaround. Am I using module correctly? If no, how can I use it to avoid such an error without adding items?
If it is not possible, I suggest the following fix:
Here https://github.com/kongondo/MenuBuilder/blob/main/MarkupMenuBuilder.module#L1366 return can be replaced from $this->throwError() to [] or array().
Hello, @kongondo!
I use the module in this way: I'm creating a site with possibility of creating blank menu without items.
On these lines I'm trying to get menu items:
Then I get an error: "No menu items found! Confirm that such a menu exists and that it has menu items." if items are not present. This is caused by the line 1366:
https://github.com/kongondo/MenuBuilder/blob/main/MarkupMenuBuilder.module#L1366
I tried to fix it manually using the fact that the menu is a page and menu items are being stored in menu_items variable:
However, it seems to be only a workaround. Am I using module correctly? If no, how can I use it to avoid such an error without adding items?
If it is not possible, I suggest the following fix:
Here https://github.com/kongondo/MenuBuilder/blob/main/MarkupMenuBuilder.module#L1366 return can be replaced from $this->throwError() to [] or array().