Package Configuration - menus
The menus
element allows you to define the various menus to add into the administration panel, member's area, public site, and any other custom areas that have been developed into the system. This element is an array of associative arrays, with each element of the associative arrays explained below.
Key | Required | Description |
---|---|---|
area | Yes | The area the menu belongs to. Will generally always be either "admin", "members" or "public" unless custom areas have been developed into the system. |
type | No | The type of menu, supported values are -- "internal", "parent", "header", "external". See below for a detailed description of each. Defaults to "internal". |
parent | No | Only applicable if this is a child menu of a parent drop down. For example, if adding a sub-menu into the Settings menu of the admin panel you would specify "settings" here. |
position | No | The position of the menu relative to its sibling menus. Supported values are "top", "bottom", "after XXX", "before XXX". See below for details, defaults to "bottom". |
icon | No | Only applicable if theme supports icons for the menu type (ie. parent menu within admin panel), and is the FontAwesome icon alias (eg. fa fa-fw fa-chart". |
alias | Yes | The alias of the menu, included within the URI when the system generates a link to the menu. Must be alphanumeric, and in all lowercase. |
name | Yes | The name of the menu as will be displayed within the web browser. |
menus | No | Only applicable if type is set to parent and is a list of sub-menus available. Simple key-value pairs, the key being the sub-menu alias, and the value being the sub-menu name. |
url | No | Only applicable if type is set to "external", and is the URL the menu links to. |
require_login | No | A 1 or 0, and defines whether or not the user must be authenticated in order to display the menu (eg. Logout). Defaults to 0. |
require_nologin | No | A 1 or 0, and defines whether or not the menu is only displayed if the user is not authenticated (eg. Login). Defaults to 0. |
type
Element
Defines the type of menu, and can be one of the following:
- parent - A parent dropdown menu that contains sub-menus, such as Settings, Users, Communicate and so on within the administration panel
- header A header to help seperate the differnt groups of menus, such as Setup, Accounts and Financial within the administration panel.
- internal - A standard menu that links to an internal page within the web site. This can either be a standalone main menu, or a sub-menu under a parent menu.
- external - A menu that links to an external URL instead of an internal page within the web site.
position
Element
Optional field that allows you to define the position of the menu relative to its sibling menus. Supports the following values:
- top - Top of the menu list, whether that's the top-level menu or within the parent menu.
- bottom - Bottom of the menu list, whether that's the top-level menu or within the parent menu. This is the default if no position is defined.
- before <ALIAS> - Will place the menu just before / on top of the menu specified within <ALIAS>. For example, to place a new menu above the Communicate menu within the admin panel, you would set the position to "before communicate".
- after <ALIAS> - Will place the menu just after / below of the menu specified within <ALIAS>. For example, to place a new menu below the Communicate menu within the admin panel, you would set the position to "after communicate".
Example
Some great examples can be found within the package.yml files of various base packages such as the webapp
and users
packages. Below is the entire menus
section from the users package which makes use of all possible elements and combinations.
menus:
admin_accounts_header:
area: admin
position: after reports
type: header
alias: hdr_accounts
name: Accounts
admin_parent_users:
area: admin
position: after hdr_accounts
type: parent
icon: fa fa-fw fa-users
alias: users
name: Users
menus:
create: Create New User
manage: Manage User
delete: Delete User
pending: Pending users
viewall: View All Users
activity: Recent Activity
admin_parent_communicate:
area: admin
position: after users
type: parent
icon: fa fa-fw fa-envelope
alias: communicate
name: Communicate
menus:
notify: Notify User
broadcast_email: Broadcast E-Mail
broadcast_sms: Broadcast SMS
login_notices: Login Notices
admin_settings:
area: admin
parent: settings
position: after notifications
alias: users
name: Users
admin_users_report:
area: admin
parent: reports
position: top
alias: users
name: Users
members_account:
area: members
position: top
type: parent
icon: fa fa-fw fa-user
alias: account
name: My Account
menus:
profile: Profile
security: Security
password: Password
delete: Delete
public_register:
area: public
position: bottom
require_nologin: 1
alias: register
name: Register
public_login:
area: public
position: bottom
require_nologin: 1
alias: login
name: Login
public_logout:
area: public
position: bottom
require_login: 1
alias: logout
name: Logout