TemplateNavigationProvider
in package
Template Navigation Provider
This service provides navigation menu items for the Template plugin. It integrates with KMP's NavigationRegistry to add plugin-specific menu items to the main application navigation.
Navigation Architecture
KMP uses a service-based navigation system where plugins register navigation providers that dynamically generate menu items based on:
- User permissions and roles
- Current context (branch, member, etc.)
- Plugin configuration settings
- Active warrants and authorizations
Menu Item Structure
Each navigation item is an array with:
- label: Display text for the menu item
- url: URL array or string for the link
- icon: Bootstrap icon class (optional)
- order: Sort order in the menu
- children: Sub-menu items (optional)
- badge: Notification badge (optional)
- active: Callback to determine if item is active
Dynamic Generation
Navigation items can be generated dynamically based on:
- User identity and permissions
- Request parameters
- Database queries
- Plugin settings
Table of Contents
Methods
- getBranchNavigationItems() : array<string|int, mixed>
- Get navigation items for branch context
- getMemberNavigationItems() : array<string|int, mixed>
- Get navigation items for member context
- getNavigationItems() : array<string|int, mixed>
- Get Navigation Items
- getUnreadCount() : int
- Example helper: Get unread count for notification badge
Methods
getBranchNavigationItems()
Get navigation items for branch context
public
static getBranchNavigationItems(mixed $user, int $branchId[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Returns navigation items specific to a branch page. These items appear in branch-specific navigation areas.
Parameters
- $user : mixed
-
The current user identity
- $branchId : int
-
The branch being viewed
- $params : array<string|int, mixed> = []
-
Additional parameters
Return values
array<string|int, mixed> —Array of navigation items
getMemberNavigationItems()
Get navigation items for member context
public
static getMemberNavigationItems(mixed $user, int $memberId[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Returns navigation items specific to a member's profile page. These items appear in member-specific navigation areas.
Parameters
- $user : mixed
-
The current user identity
- $memberId : int
-
The member being viewed
- $params : array<string|int, mixed> = []
-
Additional parameters
Return values
array<string|int, mixed> —Array of navigation items
getNavigationItems()
Get Navigation Items
public
static getNavigationItems(mixed $user[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Returns an array of navigation items for the Template plugin. This method is called by the NavigationRegistry when building the application menu.
Navigation items use the KMP navigation format with:
- type: "link" for navigation links
- mergePath: Hierarchical path array for menu organization
- label: Display text
- order: Sort order within the mergePath
- url: CakePHP URL array
- icon: Bootstrap icon class
- badgeValue: Optional dynamic badge configuration
- activePaths: Optional array of paths that highlight this nav item
Parameters
- $user : mixed
-
The current user identity (null if not logged in)
- $params : array<string|int, mixed> = []
-
Request parameters and context
Return values
array<string|int, mixed> —Array of navigation items in KMP format
getUnreadCount()
Example helper: Get unread count for notification badge
protected
static getUnreadCount(mixed $user) : int
Parameters
- $user : mixed
-
The current user identity
Return values
int —Number of unread items