loading table of contents...

7.9.1. Adding buttons to the Favorites Toolbar

The Favorites Toolbar on the left side is vertically divided into three subcontainers:

  • The top section, which in Blueprint's default configuration has buttons to open the Library, to open Bookmarks, and to create content

  • The middle section (favoritesToolbarUserItemsArea), which contains user-managed search folders. Users can add, delete, and modify their own, often used search folders in this section. Therefore, your ability to preconfigure this section is inherently different from the top and bottom section of the Favorites Toolbar. For details, see Section 7.9.2, “Providing default Search Folders” below

  • The bottom section, which in Blueprint's default configuration has a menu button for developer-defined extensions. You can add buttons within the extensions menu button (but you can also add top-level buttons above or below

If you want to add fixed buttons to the Favorites Toolbar (that is, buttons that can not be modified or removed by the user), you need to add them to either the top or the bottom section of the Favorites Toolbar.

The main BlueprintStudioPlugin.exml file shows how you can easily use the addItemsPlugin to add your own buttons to the top and bottom sections of the toolbar, respectively:

<editor:favoritesToolbar>
  <plugins>
    <ui:addItemsPlugin>
      <ui:items>
        <bp:newContentMenuButton/>
      </ui:items>
      <ui:after>
        <component itemId="{favoritesToolbar.LIBRARY_BUTTON_ITEM_ID}"/>
      </ui:after>
    </ui:addItemsPlugin>
  </plugins>
</editor:favoritesToolbar>

Ensuring a proper order of the items of the favorites toolbar helps significantly in making the application usable. Note how an after constraint is used to put the new button to a specific place. It uses the framework-predefined itemId of the Library button to describe the desired location of the added button, and references the new button via an element with Blueprint namespace - the button itself is declared in a separate EXML file in the Blueprint Studio plugin.

To add a simple test button with an action to the Blueprint definition, enter the following code inside the <items> element (see Section 7.2, “Localizing Labels” to learn how to localize the label of the button):

<button itemId="exampleButton">
  <baseAction>
    <editor:showCollectionViewAction text="toBePublished" 
     published="false" editedByMe="true" contentType="CMArticle"/>
  </baseAction>
</button>

Example 7.32. Adding a search for documents to be published


This code snippet will add a "search folder" button to the favorites toolbar that uses a showCollectionViewAction to open the Library window in a mode that searches for a restricted set of content items (please see the API documentation for showCollectionViewAction for more details).