Standard field type Joomla XML – Checkbox displays a regular checkbox for selecting an option. If there is a stored value, it will be automatically selected after the page is loaded.
The field with the checkbox looks like this:
The code for such a checkbox looks like this:
Code language: YAML (yaml)
<field name="show_title" type="checkbox" label="Опция" value="1" />
The checkbox field supports attributes:
- name – the system name of the field.
- type – the type of the field, in this case «checkbox».
- label – the display name of the field.
- description – the displayed field description. In Joomla 3, it is displayed as a tooltip when hovering over a field name.
- class – applied CSS field classes.
- value – checkbox value, typically 1.
- checked – the option allows you to make the checkbox immediately checked.
Attention! Joomla is not responsible for processing when the checkbox is saved, so you will have to work on the handler so that these options are saved and displayed correctly after saving.
For now, that’s all there is to it about the Joomla XML field type – Checkbox. If we receive new information, it will be added to this article.
Do you need help generating an XML file? Write to us at firstname.lastname@example.org and we will help you.