Checkbox
The “Checkbox” attribute stores a boolean value (0 or 1). Typical use cases:
Publication status of a record (active/inactive)
Yes/No fields (e.g. “Featured”, “Show on homepage”)
Binary state values such as “Available”, “Subscribed”, etc.
The stored value in the database is '1' (active) or '' (empty = inactive).
In the backend, the attribute appears as a checkbox widget. When the publication option is
enabled, an additional toggle button (“eye icon”) is displayed in the record list.
See also
For multilingual MetaModels, the attribute Translated Checkbox is available.
Installation
The attribute is installed via the Contao Manager or Composer:
composer require metamodels/attribute_checkbox
Settings when Creating the Attribute
In addition to the general attribute settings (name, column name, description, override variants), the checkbox attribute offers the following specific options:
Option |
Description |
|---|---|
Toggle icon |
If this option is set, an additional icon (“eye”) is added to the backend list view.
This allows the publication status of a record to be toggled directly with a click.
The column name |
Inverted display option |
Reverses the toggle status of the icon: an enabled checkbox (value |
Custom icon |
Enables the selection of custom icons for the backend list view. If this option is set, two additional fields appear:
Supported formats: jpg, jpeg, gif, png, tif, tiff, svg. |
Settings in Render Settings
The checkbox attribute has no specific render settings. In the attribute list of a render setting, the usual options are available:
Option |
Description |
|---|---|
Template |
Selection of a custom template for the output of the checkbox value. If no template
is specified, the output is as plain text ( Primarily for the list display in the backend, the template |
CSS class |
Optional CSS class added to the output element. |
Settings in the Input Form
When the checkbox attribute is added to an input form, the following options are available:
Display
Option |
Description |
|---|---|
Backend class |
CSS classes for the display of the field in the backend form (e.g.
|
Template for backend |
Selection of a custom widget template for the backend form. |
Template for frontend |
Selection of a custom widget template for frontend editing (only available if the “Frontend Editing” extension is installed). |
Functions
Option |
Description |
|---|---|
Required field |
Makes the field a required field (rarely useful for checkboxes, since an unchecked box already corresponds to a defined value). |
Submit on change |
The input form is reloaded via Ajax as soon as the checkbox is toggled
( |
Overview (backend filter)
Option |
Description |
|---|---|
Filterable |
The attribute is available in the backend as a filter criterion. |
Filter Rules
The checkbox attribute can be used with the following filter rules:
Filter rule |
Note |
|---|---|
Checkbox status |
Checks whether the checkbox value equals
|
Simple lookup |
Filters by a specific checkbox value via a URL parameter; useful when visitors should be able to filter by active/inactive themselves. |
Special Functions
Publication status (toggle icon)
When “Toggle icon” is active, MetaModels registers a toggle operation in the backend list view.
Clicking the icon switches the record’s value directly between 1 and '' without having
to open the edit form. Filtering published records in the frontend must be done via a separate
filter set with the “Checkbox status” filter rule (package filter_checkbox).
Inverted mode
The “Inverted display option” only reverses the display of the icon —
the stored value remains unchanged (1 = active, '' = inactive).
This is useful when the semantics of a field are formulated in reverse
(e.g. “Hidden” instead of “Visible”) analogous to the Contao content element.
Database storage
The value is stored as char(1) NOT NULL default '':
'1' means active, '' (empty string) means inactive.