Skip to content

Text

Text element is an input with text type.

text

Options

prefix

string Optional parameter.

postfix

string Optional parameter.

placeholder

string Optional parameter. Placeholder in input.

JSON
{
  "options":
    {
      "prefix" : "+48",
      "placeholder" : "phone number"
    }
}

Build-in Validators

Element has no build-in validators.

Available Validators

Element has available validators:

Relations Support

Element supports relations between elements.

Configuration output schema

schema
{
  "<element_type>" : "text",
  "<element_name>" : string,
  "<element_label>" : string,
  "<element_labelDescription>" : string,
  "<element_isRequired>" : bool,
  "<element_isHidden>" : bool,
  "<element_defaultValue>" : string,
  "<element_options>" : {
    "<element_option_prefix>" : string,
    "<element_option_postfix>" : string,
    "<element_option_placeholder>" : string
  },
  "<element_validators>" : []
}
example
{
  "type" : "text",
  "name" : "phone",
  "label" : "Phone number",
  "labelDescription" : "Leave your phone number for further contact",
  "isRequired" : true,
  "isHidden" : false,
  "validators": [
    {
      "type" : "length",
      "options" : { "min" : 9, "max" : 12 }
    }
  ],
  "options": {
    "prefix" : "+48",
    "placeholder" : "phone number"
  }
}

Element value

If value is filled: string.

usage in module TWIG
{% if moduleConfig.phone %}
    <p>Phone number: {{ moduleConfig.phone }}</p>
{% endif %}

Example of module

Twig

Twig
{% if moduleConfig.phone %}
    <p>{{ translate("Phone number") }}: {{ moduleConfig.phone }}</p>
{% endif %}

JSON configuration

JSON configuration
[
  {
    "label": "Contact",
    "state": "unfolded",
    "elements": [
      {
        "type": "text",
        "name": "phone",
        "label": "Phone number",
        "labelDescription": "Leave your phone number for further contact",
        "isRequired": true,
        "validators": [
          { "type": "length", "options": { "min": 9, "max": 12 } }
        ],
        "options": {
          "prefix": "+48",
          "placeholder": "phone number"
        }
      }
    ]
  }
]

JSON translations

JSON translations
{
  "module": {
    "pl_PL": {
      "Phone number": "Numer telefonu"
    },
    "en_US": {
      "Phone number": "Phone number"
    }
  },
  "schema": {
    "pl_PL": {
      "Contact": "Kontakt",
      "Phone number": "Numer telefonu",
      "Leave your phone number for further contact": "Zostaw swój numer telefonu do dalszego kontaktu"
    },
    "en_US": {
      "Contact": "Contact",
      "Phone number": "Phone number",
      "Leave your phone number for further contact": "Leave your phone number for further contact"
    }
  }
}