Reference: Data Manager top right buttons array

Reference: Data Manager top right buttons array

Several Data Manager customizations allow you modify the top right buttons that appear for a particular screen in the Data Manager. These modififications expect to either return an array of structs and/or strings, or are passed this array of structs/strings for modification / appending to.

Keys

Each "action" struct can/must have the following keys:

  • title (required): Title/label to display on the button.
  • link (optional): Required when there are no child actions.
  • btnClass (optional): Twitter bootstrap button class for the button. e.g. btn-success, btn-danger, etc.
  • iconClass (optional): Font awesome icon class to use. Icon will be displayed before the title.
  • globalKey (optional): Global keyboard key shortcut for the button.
  • prompt (optional): Prompt for the action should you want a modal dialog to appear to confirm the action.
  • match (optional): The prompt modal dialog will display this word and requires that the user enters it in order to continue.
  • target (optional): e.g. "_blank" to have the button link open in a new tab.
  • children (optional): Array of child actions that will appear in a drop-down menu on button click.

Info

Note: alternatively, a button in the array can be a fully rendered string representing the button (should you require something a bit different)

Children

If you wish your button to be a drop down menu, use the children array. Each item in the array is a struct with the following possible keys:

  • title (required): Title/label for the item
  • link (required): Link of the item
  • prompt (optional): Prompt for the action should you want a modal dialog to appear to confirm the action.
  • match (optional): The prompt modal dialog will display this word and requires that the user enters it in order to continue.
  • target (optional): Optional link target, e.g. "_blank" to open in a new tab
  • icon (optional): Font awesome icon class for the item. Icon will appear before the title

As of 10.20, child actions can be supplied as a pre-rendered string or you can supply the explicit string "---" to create a spacer entry.

Examples

A minimal button item:

{
      link      = event.buildAdminLink( objectName=objectName, operation="preview" )
    , title     = translateResource( "preside-objects.blog:preview.btn" )
    , iconClass = "fa-eye"
}

A button with children:

{
      title     = translateResource( "preside-objects.blog:options.btn" )
    , iconClass = "fa-wrench"
    , children  = [
          { title="Stats"   , link=statsLink   , icon="fa-bar-chart" }
        , { title="Download", link=downloadLink, icon="fa-download"  }
      ]
}

A button with primary action and children (from 10.20 onwards):

{
      title     = translateResource( "preside-objects.blog:options.btn" )
    , link      = event.buildAdminLink( objectName=objectName, operation="options" )
    , iconClass = "fa-wrench"
    , children  = [
          { title="Stats"   , link=statsLink   , icon="fa-bar-chart" }
        , { title="Download", link=downloadLink, icon="fa-download"  }
        , "---" // spacer
        , { title="Something else", link=someOtherLink, icon="fa-heels"  }
      ]
}