Page tree
Skip to end of metadata
Go to start of metadata

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.

Example action bar definition

Action bar in the Contacts app:

browser:
  actionbar:
    defaultAction: editContact
    sections:
      - name: root
        # group definition
      - name: deletedContact
        # group definition
      - name: deletedFolder
        # groups definition
      - name: contact
        groups:
          - name: addActions
            items:
              - name: addContact
              - name: confirmDeleteContact
          - name: editActions
            items:
              - name: editContact
              - name: renameContact
          - name: activationActions
            items:
              - name: activate
              - name: deactivate
          - name: importExportActions
            items:
              - name: export
          - name: versionsActions
            items:
              - name: showVersions
              - name: restoreVersion
        availability:
          nodeTypes:
            - mgnl:contact
Node nameValue

 browser


 actionbar


 sections


 root


 deletedContact


 deletedFolder


 contact


 groups


 addActions


 items


 addContact


 confirmDeleteContact


 editActions


 items


 editContact


 renameContact


 activationActions


 items


 activate


 deactivate


 importExportActions


 items


 export


 versionsActions


 items


 showVersions


 restoreVersion


 availability


 nodeTypes


 mgnl:contact


 defaultAction

editContact


Action bar properties

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 IsDeletedRule rule class limits action availability to the Publish 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: editContact
  sections:
    - name: root
      groups:
        # group definitions
      availability:
        nodes: false
        root: true
    - name: deletedContact
      groups:
        # group definitions
      availability:
        nodeTypes: 
          - mgnl:contact
        rules:
          - name: isDeletedRule
    - name: deletedFolder
      # groups definition
    - name: contact
      groups:
        # group definitions
      availability:
        nodeTypes: 
          - mgnl:contact
Node nameValue

 actionbar


 sections


 root


 groups


 availability


 nodes

false

 root

true

 deletedContact


 groups


 availability


 nodeTypes


 mgnl:contact


 rules


 isDeletedRule


 deletedFolder


 contact


 groups


 availability


 nodeTypes


 mgnl-contact


Availability properties

<section name>

required

Name of the action bar section.

availability

required

Action availability configuration.

access

optional

Section is available if the current user has one of the listed roles.

roles

required

Section is available to users assigned the listed roles.

<role>

required

Name of the role that is permitted to execute the action.

nodes

optional

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.

<node type>

required

A valid node type such as mgnl:folder.

rules

optional

Configuration node for availability rules.

<rule name>

required

Name of the availability rule. One node for each rule. Node name is arbitrary.

implementationClass

required

Class that contains custom logic to check if the action is permitted on the selected item. 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

Action is available at the workspace root level if true.

properties

optional

Action is available if the selected item is a property.

Here is the action bar:

  • With no selection.
  • When a contact is selected.
  • After a contact is deleted.