Documentation Center

Elements in a menuitems section in BehaviorConfig.xml

A menuitems section specifies custom (top) menu items.

menuitems
The element that can be used to add additional menu items to the Custom tab. You can insert a menuitems child element within the following behavior elements:
  • definitiontable
  • list
  • image
  • inline
  • highlighting
  • block
  • title
  • sheetbody
menuitem
The element that defines an additional menu item. It can contain the following child elements:
  • a required label child element
  • either an inserttemplate or a toggletemplate child element
menuitem can also have the following optional attributes:
  • xpath, to be used, for example, for adding a row in a table cell (if the attribute value is self::tgroup)
  • id, to be used to allow referencing from amenuitemref element.
Here is an example menuitem element:
<menuitem id="insert-paragraph">
  <label>Insert paragraph</label>
  <inserttemplate>
    <p/>
  </inserttemplate>
</menuitem>
When amenuitem element has an id attribute set, it can be referenced from a menuitemref element in the menuconfiguration of the BehaviorConfig.xml to define a menu structure for any additional custom menu:
<menuconfiguration>
  <extramenu>
    <menuitemref ref="insert-paragraph"/>
  </extramenu>
</menuconfiguration>
label
The label of the menu item.
inserttemplate
Use this element to specify a certain XML structure, which will be inserted either below the current element or below the ancestor element that is specified in the xpath attribute of the menuitem element.
An optional specialbehavior attribute with value repositoryimageselector can be used to specify that you want to pick an image using a Repository browse dialog.
Typically, you would use insert templates for all elements that allow a menuitems child element, except for the inline and highlighting elements.
Here is an example of an inserttemplate element that inserts a definition list:
<inserttemplate>
  <dl>
    <dlhead>
      <dthd/>
      <ddhd/>
    </dlhead>
    <dlentry>
      <dt/>
      <dd/>
    </dlentry>
  </dl>
</inserttemplate>
And here is an example of an inserttemplate element that inserts an image, to be selected by the author:
<inserttemplate specialbehavior="showrepositoryimageselector">
  <image placement="break" href="{{reference}}"/>
</inserttemplate>
toggletemplate
Use toggletemplate to either insert/wrap or remove/unwrap a specified XML element. If text is selected when you use toggletemplate, then the text gets wrapped with the specified element; otherwise, the element is simply inserted. If text is already wrapped within the XML element, using toggletemplate unwraps/removes the element from the text while leaving the text itself intact. Typically, you would use a toggle template for inline or highlighting elements.
The toggletemplate element includes the following:
  • elementname (required) — This attribute defines which XML element will be inserted or removed.
  • attributes (optional) — This section defines additional attribute values for the XML element specified in elementname. If used, this section must include at least one attribute element and each element requires a name to identify the attribute.
Here is an example of using a toggletemplate element to insert a <ph> element around text that should not be translated:
<toggletemplate elementname="ph">
  <attributes>
    <attribute name="outputclass">ph-class</>
    <attribute name="translate">no</>
  </attributes>
<toggletemplate/>