Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

The "Custom tag" button

The "Custom tag" button is located in the "Special Tools" area of the OE toolbar. The following image shows how this button looks like.

The "Custom tag" button

The "Custom tag" button

It is possible to use custom tags in the XML field. Custom tags allow you to create both block and inline elements. There are five default custom tags available for use:

  • Factbox (block)
  • Quote (block)
  • Strike (inline)
  • Sub (inline)
  • Sup (inline)

Custom tags must be specified using the "AvailableCustomTags[]" array in the "[CustomTagSettings]" block within a configuration override for "content.ini". Whether a custom tag is inline or not can be defined in the same block. Please refer to the " Custom tags" part located in the XML tags section of the "Reference" chapter in the "eZ Publish technical manual".

When generating XHTML code, the system will use the "table" tag for factbox, "strike" for strike, "sub" for sub, "sup" for sup. This behavior is dictated by the following templates:

  • /design/standard/templates/content/datatype/view/ezxmltags/factbox.tpl
  • /design/standard/templates/content/datatype/view/ezxmltags/strike.tpl
  • /design/standard/templates/content/datatype/view/ezxmltags/sub.tpl
  • /design/standard/templates/content/datatype/view/ezxmltags/sup.tpl

Inserting a custom tag

  1. Position your cursor at a location where you wish to add a custom tag.
  2. Click the "Custom tag" button. You can also right click and choose the "Insert custom tag" item from the context menu. The following modal dialog will appear:

    The "Insert custom tag" dialog.

  3. Select the desired custom tag name from dropdown list and click the "OK" button.

A table of attributes/properties will be displayed at the bottom. This table will most probably be empty. You can add custom attributes by clicking the "New attribute" button. To remove custom attributes select one or more attributes using the checkboxes and click the "Remove selected" button.

Inline tags

If the selected tag is an inline tag, the "Inline" checkbox will be checked and the "Text" field will be enabled. Write the tag content in the "Text" field and click the "OK" button. A new formatted text fragment will appear in the OE text area:

Online Editor: inline custom tag added.

After inserting an inline custom tag you can start writing non-formatted text at the current cursor position. When using Internet Explorer you will see a single space inserted after an inline custom tag. You should start writing non-formatted text right after this space.

If you leave the "Text" field empty, this custom tag will appear in the OE text area as a special icon:

The "Custom tag" icon

The "Custom tag" icon

To insert a text into this tag, right click on the icon and choose the "Properties" item from the context menu. Type in the tag content into the "Text" field and click the "OK" button.

Block tags

If the selected tag is not an inline tag, the "Inline" check box will not be checked and the "Text" field will be disabled. Click the "OK" button to insert the tag. A single column and single row table with sky-blue background will appear in the OE text area. Users of Mozilla based browsers will see the name of the custom tag as a tooltip:

Online Editor: block custom tag added.

When you're at this point, you can type in the tag content into the table cell.

Please note that a text / inline element inside a block custom tag will always be encapsulated by a paragraph (you can see the tag "p" in the status bar) - the paragraph tags will not be shown when the OE is disabled (when you're editing the content using simplified XML).

Editing an inline custom tag

  1. Right click on the formatted text fragment and choose the "Properties" item from the context menu. When using a Mozilla based browser, do not make any text selection before right clicking, otherwise the "Properties" item will be unavailable.

     

    Select "Properties" from the context menu to edit an inline custom tag.


    You will see a modal dialog (already described in " Inserting a custom tag").

  2. Make your changes and click the "OK" button.

Please note that if you change the name of a custom tag, you must make sure that the new tag is inline (you are not allowed to transform an inline tag into a block tag.)

Editing a block custom tag

A block custom tag is visualized as a table. The tag content is located inside a table cell. It is normal text which may contain lists, bold and italic items, custom tags and other elements. The context menu is not available for these inner elements. Please note that an inline element inside a block custom tag is always encapsulated inside a paragraph. The following text explains how to edit the tag properties.

  1. Right click on the table border or somewhere inside the table and choose the "Properties" item from the context menu.

    Select "Properties" from the context menu to edit a block custom tag.

    You will see a modal dialog (already described in " Inserting a custom tag").
  2. Make your changes and click the "OK" button.

Please note that if you change the name of a custom tag, you must make sure that the new tag is inline (you are not allowed to transform an inline tag into a block tag.)

Removing a custom tag

To remove an inline custom tag along with its text, position the cursor there and delete the text by pressing the "Delete" or the "Backspace" key.

A block custom tag is visualized as a table cell. Users of Mozilla based browsers can click somewhere inside the table and they will see two "x" elements in the table border. Clicking on an "x" will remove the table. Users of Internet Explorer can right click on the table and choose the "Delete" item from the context menu.

Nested custom tags

A block custom tag is visualized as a table. You can easily insert a block or inline custom tag into this table.

  1. Position the cursor at a location inside the table where you wish to add a custom tag (or simply click on the table border).
  2. Click the "Custom tag" button. You will see a modal dialog (already described in " Inserting a custom tag").
  3. Specify the necessary parameters and click the "OK" button.

Please note that an inline custom tag may contain nested inline tags. This feature is demonstrated in the following example.

Example

Let's insert a "strike" element into a "sup" element. The word "test" is formatted by inline custom tag "sup".

  1. Position the cursor inside this word. The "p","custom" and "Class: sup" lines in the status bar will indicate that the current element is custom tag "sup" located inside a paragraph.
  2. Click the "Custom tag" button.

    Online Editor: insert nested custom tag.

  3. You will see a modal dialog (already described in " Inserting a custom tag").
  4. Choose "strike" from the dropdown list. The "Inline" checkbox will indicates that "strike" an inline tag.
  5. Type in "aaabbb" in the "Text" field and click the "OK" button.

     

    The "Insert custom tag" dialog.


    You will see the changes immediately:

    Online Editor: nested custom tag added.

     

Svitlana Shatokhina (21/12/2005 7:54 am)

Svitlana Shatokhina (30/11/2006 12:59 pm)

Balazs Halasy, Svitlana Shatokhina


Comments

  • Custom Tags and OE and Copy & Paste

    To enable automatic convesion from some XHTML Tags to the <custom name="[tag]"> notation of ezxml try editing extension/ezdhtml/ezxmltext/common/ezxmlinputparser.php and extend the array $InputTags .

    e.g.: Converting <q> tags to <custom name="q"> add to $InputTags array:

    'q' => array( 'name' => 'custom' )

    see this post http://ez.no/community/forum/setu...r/re_customizing_ez_online_editor__8

    >In the $OutputTags array find definition of the 'custom' tag, here you should add new >conversion rules for the attributes, for example 'style' => 'custom:style', which means that >style attribute of the font tag will be converted to 'custom:style' attribute of custom tag.
    >
    >To find out which tags and attributes come from the input and what is actually stored you >can add debug output to the validateInput function. I think just uncomment these lines:
    >eZDebug::writeDebug( $text, 'HTML input' );
    >eZDebug::writeDebug( $myDomString, 'converted eZXML' );