Difference between revisions of "Category form field type"
From Joomla! Documentation
Aaron.hudon (talk | contribs) m (Added the 'published' option) |
m (removed j1.5 info) |
||
Line 1: | Line 1: | ||
[[Image:Params.category.jpg|right]] | [[Image:Params.category.jpg|right]] | ||
− | |||
− | |||
− | |||
The '''category''' form field type provides a drop down list of all published categories for a certain extension. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected. If the '''show_root''' attribute is 1, the first option on the list will be a string representing the root category (which is a translatable string) and is given the value 0. | The '''category''' form field type provides a drop down list of all published categories for a certain extension. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected. If the '''show_root''' attribute is 1, the first option on the list will be a string representing the root category (which is a translatable string) and is given the value 0. | ||
Revision as of 15:35, 25 September 2013
The category form field type provides a drop down list of all published categories for a certain extension. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected. If the show_root attribute is 1, the first option on the list will be a string representing the root category (which is a translatable string) and is given the value 0.
- type (mandatory) must be category.
- name (mandatory) is the unique name of the parameter.
- label (mandatory) (translatable) is the descriptive title of the field.
- extension (mandatory) is the name of the extension for which the categories will be retrieved. For example, to list content categories, use the value 'com_content'.
- scope (optional) is an alias for extension.
- show_root (optional) is whether a choice representing the root category will be shown.
- default (optional) is the default category ID number.
- description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
- class (optional) is a CSS class name for the HTML form field. If omitted this will default to 'inputbox'.
- published (optional) (true/false) is whether the drop down will show only published or unpublished categories.
Example XML parameter definition:
<field name="mycategory" type="category" extension="com_content" label="Select a category" description="" />