SchemaPresetsBlockOrder
Makes sure that the schema presets blocks are correctly used in the block_order attribute.
Anchor to ExamplesExamples
The following examples contain code snippets that either fail or pass this check.
Anchor to ✗ Fail✗ Fail
In the following example, the block_order attribute is missing the block_2 block:
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text"
},
"block_2": {
"type": "text"
}
},
"block_order": ["block_1"]
}
]
{% endschema %}
Anchor to ✗ Fail✗ Fail
In the following example, block_2 is static and is included in the block_order attribute, even though it shouldn't be:
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text"
},
"block_2": {
"type": "text",
"static": true
}
},
"block_order": ["block_1","block_2"]
}
]
{% endschema %}
Anchor to ✗ Fail✗ Fail
In the following example, the block_2 is in block_order but is not defined in blocks:
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "text"
}
},
"block_order": ["block_1", "block_2"]
}
]
{% endschema %}
Anchor to ✓ Pass✓ Pass
In the following example, the block_order attribute contains the correct blocks:
{% schema %}
"presets": [
{
"name": "My preset",
"blocks": {
"block_1": {
"type": "block_1"
},
"block_2": {
"type": "block_2",
"static": true
}
},
"block_order": [
"block_1"
]
}
]
{% endschema %}
Anchor to OptionsOptions
The following example contains the default configuration for this check:
SchemaPresetsBlockOrder
enabledtrue
severitywarning
| Parameter | Description |
|---|---|
enabled | Whether this check is enabled. |
severity | The severity of the check. |
Anchor to Disabling this checkDisabling this check
Disabling this check isn't recommended.
Was this page helpful?