Magnolia 5.3 reached end of life on June 30, 2017. This branch is no longer supported, see End-of-life policy.
The action bar also defines availability rules that determine which section of the action bar is displayed to the user. For example, when the user selects a content item, you want to only display actions that are relevant for that item.
The action bar references actions which are defined elsewhere. This separation allows you define an action once and use it in many places, not only in the action bar.
Here is the action bar from the Contacts app.
<section name>: Name your sections after what the user has selected, such as
folderwhen a folder is selected.
groups: Groups are actions that belong together. They are separated by horizontal lines in the action bar.
<group name>: Name your groups after what is common to the actions. For example, create an
addActionsgroup for actions like
<action name>: Name of the action. Must be the same as defined in the action definition.
availability: Defines whether the section is displayed to the user. This typically depends on what type of node the user has selected.
label: The section label is the green text displayed to users on the action bar.
defaultAction: Name of the action executed when the user double-clicks an item.
For example, in the action bar configuration in the Contacts app:
rootsection display on the root node only. The user sees the Add contact, Add folder and Import actions defined in the groups in the
contactsection display on selection of a
deletedContactsection display on selection of a
mgnl:contactnode type, but the
IsDeletedRulerule class limits action availability when a contact has been marked for deletion to the Publish deletion and Restore previous version actions. This rule returns
trueif the item is a node and has the
access: Section is available if the current user has one of the listed roles.
<role>: Name of the role that is permitted to execute the action.
nodes: Section is available if the selected item is a node.
nodeTypes: Sectionis available if the selected item is one of the node types listed.
<node type>: A valid node type such as
ruleClass: Class that contains custom logic to check if the action is permitted on the selected item. A common example is
info.magnolia.ui.api.availability.IsNotDeletedRulewhich checks that the item is not marked for deletion. Your custom class must extend AbstractAvailabilityRule .
root: Action is available at the workspace root level if true.
properties: Action is available if the selected item is a property.
Here's the action bar:
Action bar availability is different from action availability where availability rules are defined on an individual action level and apply to each use of the action.