Skip to content

Commit 7472d4d

Browse files
authored
Merge pull request #917 from Shopify/miaz/allow-names-on-preset-blocks
Allow Names on Preset Blocks
2 parents 378b60b + 4e55e00 commit 7472d4d

5 files changed

+20
-3
lines changed

schemas/theme/preset_blocks.json

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"properties": {
1717
"static": true,
1818
"type": true,
19+
"name": true,
1920
"settings": true,
2021
"blocks": {
2122
"$ref": "#/definitions/blocksArray"
@@ -52,6 +53,7 @@
5253
"properties": {
5354
"static": true,
5455
"type": true,
56+
"name": true,
5557
"settings": true,
5658
"blocks": {
5759
"$ref": "#/definitions/blocksHash"
@@ -72,6 +74,10 @@
7274
"type": "string",
7375
"description": "The block type."
7476
},
77+
"name": {
78+
"type": "string",
79+
"description": "The block name."
80+
},
7581
"settings": {
7682
"$ref": "./default_setting_values.json"
7783
},

tests/fixtures/section-nested-blocks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"type": "group",
1010
"blocks": [
1111
{ "type": "text", "settings": { "text": "Hello" } },
12-
{ "type": "header", "settings": { "text": "World" } }
12+
{ "type": "header", "name": "Header", "settings": { "text": "World" } }
1313
]
1414
}
1515
]

tests/fixtures/section-schema-preset-blocks-as-hash.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"blocks": {
1515
"exampleBlock": {
1616
"type": "text",
17+
"name": "Example Block",
1718
"settings": {}
1819
},
1920
"exampleBlock2": {

tests/fixtures/theme-block-basics.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,17 @@
2424
"blocks": [
2525
{
2626
"type": "thing",
27+
"name": "The Thing",
2728
"settings": {
2829
"some-setting": "some-value"
29-
}
30+
},
31+
"blocks": [
32+
{
33+
"type": "text",
34+
"name": "Nested Text Block",
35+
"settings": {}
36+
}
37+
]
3038
},
3139
{
3240
"type": "button",

tests/fixtures/theme-block-presets-as-hash.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
},
2828
"some-other-block-id": {
2929
"type": "image",
30+
"name": "Image Block",
3031
"static": true,
3132
"settings": {
3233
"some-setting": "some-value"
3334
},
3435
"blocks": {
3536
"nested-block-id": {
36-
"type": "text"
37+
"type": "text",
38+
"name": "Nested Text Block"
3739
}
3840
},
3941
"block_order": ["nested-block-id"]

0 commit comments

Comments
 (0)