Difference between revisions of "User Group List form field type"

From Joomla! Documentation

(Usergrouplist standard form field type)
 
m (Removed msiplaced text from default description)
Line 15: Line 15:
 
* '''checksuperusergroup''' (optional) is boolean to omit Super User groups. Values 1 or 0.</translate>
 
* '''checksuperusergroup''' (optional) is boolean to omit Super User groups. Values 1 or 0.</translate>
 
<translate><!--T:8-->
 
<translate><!--T:8-->
* '''default''' (optional) is the usergroup id of the default selection in the dropdown list. If omitted the width is determined by the browser.</translate>
+
* '''default''' (optional) is the usergroup id of the default selection in the dropdown list. </translate>
 
<translate><!--T:9-->
 
<translate><!--T:9-->
 
* '''multiple''' (optional) If set to ''true'' then allows more than one usergroup to be selected.</translate>
 
* '''multiple''' (optional) If set to ''true'' then allows more than one usergroup to be selected.</translate>

Revision as of 09:11, 13 June 2023

The usergrouplist form field type provides a dropdown select box of user groups.

  • type (mandatory) must be usergrouplist.
  • name (mandatory) is the unique name of the field. This must match the name of the query results column that contains the values that will be shown to the user in the drop-down list, unless a different name is specified in the value_field attribute.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • layout (optional) (translatable) is the layout, for example joomla.form.field.list-fancy-select.
  • checksuperusergroup (optional) is boolean to omit Super User groups. Values 1 or 0.
  • default (optional) is the usergroup id of the default selection in the dropdown list.
  • multiple (optional) If set to true then allows more than one usergroup to be selected.

Implemented by: libraries/src/Form/Field/UsergrouplistField.php

Example of usergrouplist form field definition:

	<field
		name="usergroup"
		type="UserGroupList"
		label="MOD_EXAMPLE_USERGROUP_LABEL"
		description="MOD_EXAMPLE_USERGROUP_DESC"
		layout="joomla.form.field.list-fancy-select"
		checksuperusergroup="1"
		default=""
		multiple="0"
		>
		<option value="0">MOD_EXAMPLE_SELECT</option>
	</field>

See also[edit]