Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-28110

As a developer, I want to define attributes for custom tags

    XMLWordPrintable

    Details

    • Story Points:
      1

      Description

      Abstract

      Add to the custom tags configuration elements to define the tag's attributes at backend level. Those will be used to generate the editing UI for a custom tag in the OE.

      Custom tags

      Any number of attribute can be added to a custom tag:

        <div data-ezelement="eztemplate" data-ezname="externalimage" class="templateClass2" data-ezalign="right">
          <span data-ezelement="ezconfig">
            <span data-ezelement="ezvalue" data-ezvalue-key="src">http://upload.wikimedia.org/wikipedia/commons/c/c6/R-S_mk2.gif</span>
            <span data-ezelement="ezvalue" data-ezvalue-key="height">365</span>
            <span data-ezelement="ezvalue" data-ezvalue-key="width">500</span>
            <span data-ezelement="ezvalue" data-ezvalue-key="alt">flip-flop</span>
            <span data-ezelement="ezvalue" data-ezvalue-key="caption">bistable multivibrator</span>
          </span>
        </div>
      

      They are made available in the tag template in the params variable.

      Configuration

      The custom tag configuration must be added support for the following:

      <tag_name>:
          attributes:
              <attribute_name>:
                  type: <type>
                  required: <false|true>
                  default_value: <default_value>
      

      Initial supported types:

      • "number"
      • "string"
      • "boolean"
      • "choice"

      The types system should be open enough so that:

      • custom types can be defined, including their editing interface and how they're serialized
      • in a later iteration, fieldtypes can be used as attributes types (this needs to be better explored in a spike)

      Label and description

      An attribute needs to have a human readable, translatable label as well as a description. These should be implemented using the i18n system, with the identifier as the prefix: richtext_tag_<identifier>label, richtext_tag<identifier>_description.

      Backend validation

      Attributes posted for a custom tag in XML should be validated for :

      • existence: an error should occur if a custom attribute is set but not defined in the configuration).
      • required status: if a required attribute is missing, an error should be thrown.
      • type: if an attribute doesn't have the right type, an error should be thrown.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              bertrand.dunogier@ez.no Bertrand Dunogier
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: