Skip to main content

Choice-Multiple

A checkbox field for selecting multiple options from a predefined list. Ideal for tags, categories, or any multi-choice options.

Screenshots

Field render in form:

field preview

Field render in field group:

field preview

Configuration

  • Settings:

    • Name: The label for the field.
    • Slug: The unique technical identifier.
    • Choices: List of selectable options for the field.
    • Default values: Default selected options 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.
    • Text before: Additional text displayed before the field.
    • Text after: Additional text displayed after the field.

Return format

  • Type: array[string]
  • Note: Return the option key if defined.

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)}

{foreach from=$data.field_group_slug.field_slug item=value}
..
{/foreach}
/SomeClass.php
function someMethod()
{
$dataRetriever = DataRetrieverFacade::getInstance();

$data = $dataRetriever->get($object); // Object
$data = $dataRetriever->get('product', $idProduct); // Entity and id

$values = $data['field_group_slug']['field_slug'];

foreach ($values as $value) {
..
}
}