Actions

Difference between revisions of "Category form field type"

From Joomla! Documentation

m (Added the 'published' option)
(Marked this version for translation)
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
<noinclude><languages /></noinclude>
 +
<translate><!--T:1-->
 +
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.</translate>
 
[[Image:Params.category.jpg|right]]
 
[[Image:Params.category.jpg|right]]
 +
<translate><!--T:2-->
 +
* '''type''' (mandatory) must be ''category''.</translate>
 +
<translate><!--T:3-->
 +
* '''name''' (mandatory) is the unique name of the parameter.</translate>
 +
<translate><!--T:4-->
 +
* '''label''' (mandatory) (translatable) is the descriptive title of the field.</translate>
 +
<translate><!--T:5-->
 +
* '''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'.</translate>
 +
<translate><!--T:6-->
 +
* '''scope''' (optional) is an alias for extension.</translate>
 +
<translate><!--T:7-->
 +
* '''show_root''' (optional) is whether a choice representing the root category will be shown.</translate>
 +
<translate><!--T:8-->
 +
* '''default''' (optional) is the default category ID number.</translate>
 +
<translate><!--T:9-->
 +
* '''description''' (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.</translate>
 +
<translate><!--T:10-->
 +
* '''class''' (optional) is a CSS class name for the HTML form field.  If omitted this will default to 'inputbox'.</translate>
 +
<translate><!--T:11-->
 +
* '''published''' (optional) (true/false) is whether the drop down will show only published or unpublished categories.</translate>
 +
<translate>
 +
<!--T:17-->
 +
* '''multiple''' (optional) (true/false) is the ability to add more than 1 category to the form field</translate>
  
{{Ambox|type=notice|text=In Joomla! 1.5, [[Form field|form fields]] were [[Parameter|parameters]]. For that version, you may want to use the corresponding [[Category parameter type]].}}
+
<translate><!--T:12-->
 +
Implemented by</translate> libraries/legacy/form/field/category.php.
  
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.
+
<translate><!--T:13-->
 +
Example XML parameter definition:</translate>
 +
<source lang="xml"><field name="mycategory" type="category" extension="com_content" label="Select a category" description="" /></source>
 +
<noinclude>
  
* '''type''' (mandatory) must be category.
+
<translate>=== See also === <!--T:14--></translate>
* '''name''' (mandatory) is the unique name of the parameter.
+
<translate><!--T:15-->
* '''label''' (mandatory) (translatable) is the descriptive title of the field.
+
* [[S:MyLanguage/Standard form field types|List of standard form field types]]</translate>
* '''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:
 
<source lang="xml"><field name="mycategory" type="category" extension="com_content" label="Select a category" description="" /></source>
 
 
<noinclude>
 
<noinclude>
=== See also ===
+
<translate>
* [[Standard form field types|List of standard form field types]]
+
<!--T:16-->
[[Category:Standard form field types]]</noinclude>
+
[[Category:Standard form field types]]
 +
</translate>
 +
</noinclude>

Latest revision as of 06:17, 12 January 2016

Other languages:
English • ‎español • ‎français • ‎Nederlands

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.

Params.category.jpg
  • 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.
  • multiple (optional) (true/false) is the ability to add more than 1 category to the form field

Implemented by libraries/legacy/form/field/category.php.

Example XML parameter definition:

<field name="mycategory" type="category" extension="com_content" label="Select a category" description="" />


See also