public function GroupMenuService::loadUserGroupMenusByGroup in Group Menu 8
Load a list of menus for a group where a user can perform a operation.
Parameters
string $op: The operation to perform on the menu.
int $group_id: The group ID to load the menus from.
\Drupal\Core\Session\AccountInterface $account: Run access checks for this account.
Return value
\Drupal\system\MenuInterface[] An array of menu objects keyed by menu name.
Overrides GroupMenuServiceInterface::loadUserGroupMenusByGroup
1 call to GroupMenuService::loadUserGroupMenusByGroup()
- GroupMenuService::loadUserGroupMenus in src/
GroupMenuService.php - Load a list of menus where a user can perform a operation.
File
- src/
GroupMenuService.php, line 160
Class
- GroupMenuService
- Checks access for displaying menu pages.
Namespace
Drupal\groupmenuCode
public function loadUserGroupMenusByGroup($op, $group_id, AccountInterface $account = NULL) {
if (!isset($account)) {
$account = $this->currentUser;
}
if (isset($this->userGroupMenus[$op][$account
->id()][$group_id])) {
return $this->userGroupMenus[$op][$account
->id()][$group_id];
}
$group_menus = $this
->getGroupMenus();
$group_menu_for_group = !empty($group_menus[$group_id]) ? $group_menus[$group_id] : [];
return $this->userGroupMenus[$op][$account
->id()][$group_id] = $group_menu_for_group;
}