CountrySelector¶
CountrySelector element is a select list with available and active countries.

Build-in Validators¶
Element validate if chosen country exists and is active.
Available Validators¶
Element has available validators:
Relations Support¶
Element does not support relations between elements.
Configuration output schema¶
schema
{
"<element_type>" : "countrySelector",
"<element_name>" : string,
"<element_label>" : string,
"<element_labelDescription>" : string,
"<element_isRequired>" : bool,
"<element_isHidden>" : bool,
"<element_defaultValue>" : int,
"<element_validators>" : []
}
example
{
"type": "countrySelector",
"name": "country",
"label": "Displayed countries",
"isRequired": false,
"isHidden": false,
"defaultValue": 5,
"validators": [
{ "type" : "lessEqThan", "options" : { "max" : 100 } }
]
}
Element value¶
If value is filled: int.
usage in module TWIG
{% if moduleConfig.country %}
Displayed country: {{ moduleConfig.country }}
{% endif %}
Example of module¶
Twig¶
Twig
{% set countryId = moduleConfig.selectedCountryId %}
{% if countryId %}
{% set country = ObjectApi.getCountry(countryId) %}
{% if country %}
<section>
<div>
<h2 class="h2">{{ translate("Country") }} : {{ country.name }}</h2>
{% if moduleConfig.showCountryCode %}
<p>
{{ country.code }}
</p>
{% endif %}
</div>
</section>
{% endif %}
{% endif %}
JSON configuration¶
JSON configuration
[
{
"label": "Country",
"state": "unfolded",
"elements": [
{
"name": "selectedCountryId",
"type": "countrySelector",
"label": "Select Country"
},
{
"name": "showCountryCode",
"type": "checkbox",
"label": "Show country code"
}
]
}
]
JSON translations¶
JSON translations
{
"module": {
"pl_PL": {
"Country": "Kraj"
},
"en_US": {
"Country": "Country"
}
},
"schema": {
"pl_PL": {
"Country" : "Kraj",
"Select Country" : "Wybierz kraj",
"Show country code" : "Pokaż kod kraju"
},
"en_US": {
"Country" : "Country",
"Select Country" : "Select Country",
"Show country code" : "Show country code"
}
}
}