Boolean
A field for entering true/false values, typically displayed as a checkbox or switch. Useful for binary options like "Yes/No" or "Enabled/Disabled".
Screenshots
Field render in form:
Field render in field group:
Configuration
-
Settings:
- Name: The label for the field.
- Slug: The unique technical identifier.
- Default value: Default value for the field.
-
Validation:
- Require: Determines if the field must be filled out.
-
Design:
- Instructions: Text displayed alongside the field providing details about the data needed.
- Width: The width of the field in the form.
- Classes: Custom CSS classes for styling the field.
- ID: Custom ID attribute for the field.
Return format
- Type: boolean
Usage
/some-template.tpl
{* Object or Entity and Id *}
{assign var="data" value=$modules.customfieldgroups.data->get($product)}
{assign var="data" value=$modules.customfieldgroups.data->get('product', $product.id)}
{if $data.field_group_slug.field_slug}
..
{/if}
/SomeClass.php
function someMethod()
{
$dataRetriever = DataRetrieverFacade::getInstance();
$data = $dataRetriever->get($object); // Object
$data = $dataRetriever->get('product', $idProduct); // Entity and id
$value = (bool) $data['field_group_slug']['field_slug'];
if($value) {
..
}
}
