Actions

Repeatable form field type

From Joomla! Documentation

Revision as of 10:44, 23 February 2014 by Wilsonge (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Provides a modal with rows of formfields that you specify. As many options can be added as desired. Note this form field has a jQuery based javascript file as a dependency.

  • name (mandatory) is the unique name of the parameter.
  • type (mandatory) must be repeatable.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • description description text for the form field. Displays at the top of the modal with the name as well as in the usual position in the form
  • default The default value for the form field if the field is left empty.
  • id id of the hidden from field. (the modal will have this id with an added suffix of "_modal" and the table within the modal will have this id with a suffix of _modal_table")
  • class class of the table.
  • select (translatable) The text to show on the modal button.
  • icon the icon to show on the select button (is prefixed with "icon-").
  • maximum the maximum number of rows of fields allowed (by default 999 to be effectively infinite)

Example XML Definition

        <field name="list_templates"
type="Repeatable"
icon="list"
description="PLG_TINY_FIELD_TEMPLATE_FIELD_ELEMENTS_DESC"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_ELEMENTS_LABEL"
default="{'template':['Layout','Simple snippet'],'location':['layout1.html','snippet1.html'],'description':['HTMLLayout','Simple HTML snippet']}">
<fields name="params">
<fieldset hidden="true" name="list_templates_modal" repeat="true">
<field name="template"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_NAME_LABEL"
size="30"
type="text"/>
<field name="location"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_LOCATION_LABEL"
description="PLG_TINY_FIELD_TEMPLATE_LOCATION_DESC"
size="30"
type="filelist"
directory="media/editors/tinymce/templates"
exclude="index.html"
hide_default="true"
hide_none="true"/>
<field name="description"
label="PLG_TINY_FIELD_TEMPLATE_FIELD_DESCRIPTION_LABEL"
size="30"
type="textarea"
/>
</fieldset>
</fields>
</field>