An action bar organizes actions into sections and groups. The bar is
typically displayed on the right hand side of an app. In content apps,
the browser subapp has an action bar that allows the user to manage
content items (add, edit or delete).
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 that are
defined elsewhere. This
separation allows you to define an action once and use it in many
places, not only in the action bar.
browser:actionbar:defaultAction:editContactsections:-name:root# group definition-name:deletedContact# group definition-name:deletedFolder# groups definition-name:contactgroups:-name:addActionsitems:-name:addContact-name:confirmDeleteContact-name:editActionsitems:-name:editContact-name:renameContact-name:activationActionsitems:-name:activate-name:deactivate-name:importExportActionsitems:-name:export-name:versionsActionsitems:-name:showVersions-name:restoreVersionavailability:nodeTypes:-mgnl:contactCopy
Action bar properties
Property
Description
actionbar
required
Action bar configuration.
sections
required
Sections defined in the bar.
<section name>
required
Name of the section. Name your sections after what the user has
selected, such as folder when a folder is selected.
groups
required
Actions that belong together. Separated by horizontal lines in the
action bar.
<group name>
required
Name of the group.
items
required
Node containing the action names.
<action name>
required
Name of the action. Must be the same as the name defined in
Dialog definition.
availability
optional
Defines whether the section is displayed to the user. Typically depends
on what type of node the user has selected.
label
optional
Green text displayed to users in the action bar.
defaultAction
optional
Name of the action executed when the user double-clicks an item.
Action bar availability
Action bar availability defines whether a particular section of the
action bar is available.
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.
For example, in the action bar configuration in the
Contacts app:
Actions in the root section appear on the root node only. The user
sees the Add contact, Add folder and Import actions defined in the
groups in the root section.
Actions in the contact section appear on selection of a
mgnl:contact node type.
Actions in the deletedContact section appear on selection of a
mgnl:contact node type, but the IsDeletedRulerule
class limits action availability to the Request permanent deletion and Restore
previous version actions when a contact has been marked for deletion.
This rule returns true if the item is a node and has the
mgnl:deleted mixin type.
actionbar:defaultAction:editContactsections:-name:rootgroups:# group definitionsavailability:nodes:falseroot:true-name:deletedContactgroups:# group definitionsavailability:nodeTypes:-mgnl:contactrules:-name:isDeletedRule-name:deletedFolder# groups definition-name:contactgroups:# group definitionsavailability:nodeTypes:-mgnl:contactCopy
Availability properties
Property
Description
<section name>
required
Name of the section.
availability
required
Defines the availability configuration for the section.
access
optional
Section is available if the current user has one of the listed roles.
roles
required
Section is available to users assigned the list of roles.
<role>
required
Name of the role that is permitted to execute the action. Add one property for each role.
nodes
optional, default is true
Section is available if the selected item is a node.
nodeTypes
optional
Section is available if the selected item is one of the node types
listed.
Section is available if the selected item matches every availability rule class.
<rule name>
required
It gives the node a name that describes the rule class. One node for each rule, and the node name is arbitrary.
class
required (unless $type is used)
Action availability
definition class. The class must implement the
info.magnolia.ui.api.availability.AvailabilityDefinition
interface. Set the value to the fully qualified class name.
$type
You can use this as a shortcut for class if the definition class is
annotated with info.magnolia.ui.api.availability.AvailabilityRuleType.
The proper value is defined by the annotation.
implementationClass
required
The class that contains custom logic to check if the action is permitted on the selected item and implements info.magnolia.ui.availability.rule.AvailabilityRule. Your custom class must extend
info.magnolia.ui.availability.rule.AbstractAvailabilityRule. A default implementation class is typically hard-coded in the definition class.
You only need to add this property if you want to override the default implementation.
root
optional
Section is available at the workspace root level if true.
folder
optional, default is null
Action is available for folders only if true, and for non-folder content only if false. When this property is not specified, the action is available for both folders and non-folder content.
This option is for CDS content and is not supported for JCR content. Please see the nodeTypes option and use mgnl:folder node type to specify availability for folders in JCR.
properties
optional, default is false
Section is available if the selected item is a property.
multiple
optional, default is false
Defines whether the action is available for multiple items.
Set to true if the action requires write permission on the currently selected node. The action will be disabled if the user does not have
write permission.
Action bar structure
The structure of the action bar differs from app to app.
Here’s an example of the action bar in the Contacts app.