ContentBlocks ContentBlocks 2.x Input Types Number
The number input lets the editor provide a numeric value.
Table of Contents
Supported properties
min: the minimum value that will be acceptedmax: the maximum value that will be acceptedsteps: the size of the steps between the min and max that is allowed. For example1requires the value to be an integer, but0.5will allow half values.styles: an object of css styles to apply to the input
Returned values
value: the provided number
Example block
{
"title": "Completed Projects",
"description": "Number of completed projects this year.",
"inputs": {
"projectsLabel": {
"type": "label",
"width": 30,
"properties": {
"for": "projects",
"text": "projects"
}
},
"projects": {
"type": "number",
"width": 30,
"properties": {
"min": 0,
"steps": 1
}
},
"projectsSpacer": {
"type": "spacer",
"width": 40
}
}
}
Example template structures
Twig
{% if projects.value is not empty %}
<p class="stat">
<strong>{{ projects.value }}</strong> projects completed
</p>
{% endif %}
tpl
[[+projects.value:notempty=`<p class="stat"><strong>[[+projects.value]]</strong> projects completed</p>`]]