Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For a good example of how to add a custom tag to the valid list of htmlformentry tags from another module (or, in other words, how to register a custom tag handler from another module), see the htmlformflowsheet module.

Defining attribute descriptors for custom tags

Starting in HtmlFormEntry version 1.7.2, all tag handlers are required to implement a getAttributeDescriptors method.  Attribute descriptors are used to define what attributes a tag supports to facilitate sharing tags via the metadata sharing module.  When preparing a form for export, all metadata referenced by the form need to be included in the export package.  For example, in the following tag, all the concepts referenced by id, uuid, or concept mapping need to be included in the export package:

Attribute descriptors provide a means for a tag handler to define how to find all the metadata that may be referenced within the tag.  For example, the DrugOrderTagHandler defines the following descriptors:

The easiest way to add attribute descriptor support to a tag handler is for the tag handler to extend AbstractTagHandler, which provides a basic implementation getAttributeDescriptor that returns null.  To define attribute attribute descriptors, override the AbstractTagHandler createAttributeDescriptors method as shown above for DrugOrderTagHandler.  (Note that SubstitutionTagHandler now extends AbstractTagHandler, so any tag handler that currently extends SubstutitionTagHandler will have default attribute descriptor support built-in.

...

Note that any existing custom tag handlers will need to be modified to implement getAttributeDescriptors to work with verison 1.7.2 (though if the custom tag handler already implements SubstitutionTagHandler, no change will be required).

...