Warning: You are browsing the documentation from version 4 to 10 of Pimcore. Please visit https://pimcore.com/docs/platform/ for the latest versions of Pimcore.
Version: Edit on GitHub

Select Editable


The select editable generates select-box component in Editmode.


Name Type Description
store array Key/Value pairs for the available options.
reload bool Set true to reload the page in editmode after selecting an item
width integer Width of the select box in pixel
class string A CSS class that is added to the surrounding container of this element in editmode
defaultValue string A default value for the available options. Note: This value needs to be saved before calling getData() or use setDataFromResource().
required boolean (default: false) set to true to make field value required for publish
editable boolean (default: false) set to true to allow custom option


Name Return Description
getData() string Value of the select, this is useful to get the value even in editmode
isEmpty() bool Whether the editable is empty or not.


Basic Usage

The code below shows a select box in editmode, in the frontend preview you will see simply the value of the chosen option.

{% if editmode %}
    {{ pimcore_select("valid_for", {
            "store": [
                ["one-month", "One month"],
                ["three-months", "Three months"],
                ["unlimited", "Unlimited"]
            "defaultValue" : "unlimited"
        }) }}
{% else %}
        {{ "Something is valid for" | trans }}:{{ pimcore_select("valid_for").getData() | trans  }}
{% endif %}

Editmode: Select editable in editmode

Frontend: Select editable in frontend

Preselect the option

You can preselect an option in your select editable by using setDataFromResource()

{% if editmode %}
    {% if pimcore_select('valid_for').isEmpty() %}
        {% do pimcore_select('valid_for').setDataFromResource('unlimited') %}
    {% endif %}
{% endif %}