@airfleet/generator-init 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  import Generator from "yeoman-generator";
3
+ import { paramCase } from "change-case";
3
4
 
4
5
  import themeFeature from "../../utils/log/themeFeature.js";
5
6
  import nameCases from "../../utils/nameCases.js";
@@ -25,6 +26,13 @@ export default class extends Generator {
25
26
  name: "blockDescription",
26
27
  message: "How would you describe the block?",
27
28
  },
29
+ {
30
+ type: "list",
31
+ name: "blockKind",
32
+ message: "What kind of block do you want to start with?",
33
+ choices: ["Barebones", "Building block", "Building repeater block"],
34
+ default: "Barebones",
35
+ },
28
36
  {
29
37
  type: "confirm",
30
38
  name: "createBlockComposer",
@@ -57,7 +65,8 @@ export default class extends Generator {
57
65
 
58
66
  this.answers = await this.prompt(prompts);
59
67
  this.name = nameCases(this.answers.blockName);
60
- this.acf = acfData({ prefix: "group_" });
68
+ this.kind = paramCase(this.answers.blockKind);
69
+ this.acf = acfData({ fields: this._acfFields(this.kind) });
61
70
  this.data = {
62
71
  answers: this.answers,
63
72
  name: this.name,
@@ -65,10 +74,70 @@ export default class extends Generator {
65
74
  };
66
75
  }
67
76
 
77
+ _acfFields(kind) {
78
+ if (kind === "building-block") {
79
+ return [
80
+ "headerTab",
81
+ "sectionHeaderGroup",
82
+ "sectionHeaderClone",
83
+ "textTab",
84
+ "textGroup",
85
+ "textClone",
86
+ "mediaTab",
87
+ "mediaGroup",
88
+ "mediaClone",
89
+ "buttonsTab",
90
+ "buttonsGroup",
91
+ "buttonsClone",
92
+ "formTab",
93
+ "formGroup",
94
+ "formClone",
95
+ "settingsTab",
96
+ "backgroundGroup",
97
+ "backgroundClone",
98
+ ];
99
+ }
100
+
101
+ if (kind === "building-repeater-block") {
102
+ return [
103
+ "headerTab",
104
+ "headerGroup",
105
+ "headerClone",
106
+ "textTab",
107
+ "showText",
108
+ "textGroup",
109
+ "textClone",
110
+ "columnsTab",
111
+ "columnsRepeater",
112
+ "columnsMediaTab",
113
+ "columnsMediaGroup",
114
+ "columnsMediaClone",
115
+ "columnsTitleTab",
116
+ "columnsTitleGroup",
117
+ "columnsTitleClone",
118
+ "columnsTextTab",
119
+ "columnsTextGroup",
120
+ "columnsTextClone",
121
+ "columnsCtaTab",
122
+ "columnsCtaGroup",
123
+ "columnsCtaClone",
124
+ "buttonsTab",
125
+ "showButtons",
126
+ "buttonsGroup",
127
+ "buttonsClone",
128
+ "settingsTab",
129
+ "backgroundGroup",
130
+ "backgroundClone",
131
+ ];
132
+ }
133
+
134
+ return [];
135
+ }
136
+
68
137
  writing() {
69
138
  const templates = [
70
139
  {
71
- template: "block.blade.php.ejs",
140
+ template: `${this.kind}.blade.php.ejs`,
72
141
  destination: `theme/blocks/${this.name.slug}.blade.php`,
73
142
  isEnabled: true,
74
143
  },
@@ -88,7 +157,7 @@ export default class extends Generator {
88
157
  isEnabled: this.answers.createBlockScript,
89
158
  },
90
159
  {
91
- template: "acf/group.json.ejs",
160
+ template: `acf/${this.kind}.json.ejs`,
92
161
  destination: `theme/acf-json/${this.acf.key}.json`,
93
162
  isEnabled: this.answers.createBlockAcf,
94
163
  },
@@ -0,0 +1,348 @@
1
+ {
2
+ "key": "<%= acf.key %>",
3
+ "title": "Block: <%= name.title %>",
4
+ "fields": [
5
+ {
6
+ "key": "<%= acf.fields.headerTab %>",
7
+ "label": "Header",
8
+ "name": "",
9
+ "type": "tab",
10
+ "instructions": "",
11
+ "required": 0,
12
+ "conditional_logic": 0,
13
+ "wrapper": {
14
+ "width": "",
15
+ "class": "",
16
+ "id": ""
17
+ },
18
+ "placement": "left",
19
+ "endpoint": 0
20
+ },
21
+ {
22
+ "key": "<%= acf.fields.sectionHeaderGroup %>",
23
+ "label": "Section Header",
24
+ "name": "section_header",
25
+ "type": "group",
26
+ "instructions": "",
27
+ "required": 0,
28
+ "conditional_logic": 0,
29
+ "wrapper": {
30
+ "width": "",
31
+ "class": "",
32
+ "id": ""
33
+ },
34
+ "layout": "block",
35
+ "sub_fields": [
36
+ {
37
+ "key": "<%= acf.fields.sectionHeaderClone %>",
38
+ "label": "Section Header",
39
+ "name": "section_header",
40
+ "type": "clone",
41
+ "instructions": "",
42
+ "required": 0,
43
+ "conditional_logic": 0,
44
+ "wrapper": {
45
+ "width": "",
46
+ "class": "",
47
+ "id": ""
48
+ },
49
+ "clone": [
50
+ "group_5d10c6c72aa88"
51
+ ],
52
+ "display": "seamless",
53
+ "layout": "block",
54
+ "prefix_label": 0,
55
+ "prefix_name": 0
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "key": "<%= acf.fields.textTab %>",
61
+ "label": "Text",
62
+ "name": "",
63
+ "type": "tab",
64
+ "instructions": "",
65
+ "required": 0,
66
+ "conditional_logic": 0,
67
+ "wrapper": {
68
+ "width": "",
69
+ "class": "",
70
+ "id": ""
71
+ },
72
+ "placement": "top",
73
+ "endpoint": 0
74
+ },
75
+ {
76
+ "key": "<%= acf.fields.textGroup %>",
77
+ "label": "Text",
78
+ "name": "text",
79
+ "type": "group",
80
+ "instructions": "",
81
+ "required": 0,
82
+ "conditional_logic": 0,
83
+ "wrapper": {
84
+ "width": "",
85
+ "class": "",
86
+ "id": ""
87
+ },
88
+ "layout": "block",
89
+ "sub_fields": [
90
+ {
91
+ "key": "<%= acf.fields.textClone %>",
92
+ "label": "Text",
93
+ "name": "text",
94
+ "type": "clone",
95
+ "instructions": "",
96
+ "required": 0,
97
+ "conditional_logic": 0,
98
+ "wrapper": {
99
+ "width": "",
100
+ "class": "",
101
+ "id": ""
102
+ },
103
+ "clone": [
104
+ "group_5d10c3212d211"
105
+ ],
106
+ "display": "seamless",
107
+ "layout": "block",
108
+ "prefix_label": 0,
109
+ "prefix_name": 0
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "key": "<%= acf.fields.mediaTab %>",
115
+ "label": "Media",
116
+ "name": "",
117
+ "type": "tab",
118
+ "instructions": "",
119
+ "required": 0,
120
+ "conditional_logic": 0,
121
+ "wrapper": {
122
+ "width": "",
123
+ "class": "",
124
+ "id": ""
125
+ },
126
+ "placement": "top",
127
+ "endpoint": 0
128
+ },
129
+ {
130
+ "key": "<%= acf.fields.mediaGroup %>",
131
+ "label": "Media",
132
+ "name": "media",
133
+ "type": "group",
134
+ "instructions": "",
135
+ "required": 0,
136
+ "conditional_logic": 0,
137
+ "wrapper": {
138
+ "width": "",
139
+ "class": "",
140
+ "id": ""
141
+ },
142
+ "layout": "block",
143
+ "sub_fields": [
144
+ {
145
+ "key": "<%= acf.fields.mediaClone %>",
146
+ "label": "Media",
147
+ "name": "media",
148
+ "type": "clone",
149
+ "instructions": "",
150
+ "required": 0,
151
+ "conditional_logic": 0,
152
+ "wrapper": {
153
+ "width": "",
154
+ "class": "",
155
+ "id": ""
156
+ },
157
+ "clone": [
158
+ "group_5dd2ebd632e0c"
159
+ ],
160
+ "display": "seamless",
161
+ "layout": "block",
162
+ "prefix_label": 0,
163
+ "prefix_name": 0
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "key": "<%= acf.fields.buttonsTab %>",
169
+ "label": "Buttons",
170
+ "name": "",
171
+ "type": "tab",
172
+ "instructions": "",
173
+ "required": 0,
174
+ "conditional_logic": 0,
175
+ "wrapper": {
176
+ "width": "",
177
+ "class": "",
178
+ "id": ""
179
+ },
180
+ "placement": "top",
181
+ "endpoint": 0
182
+ },
183
+ {
184
+ "key": "<%= acf.fields.buttonsGroup %>",
185
+ "label": "Buttons",
186
+ "name": "buttons",
187
+ "type": "group",
188
+ "instructions": "",
189
+ "required": 0,
190
+ "conditional_logic": 0,
191
+ "wrapper": {
192
+ "width": "",
193
+ "class": "",
194
+ "id": ""
195
+ },
196
+ "layout": "block",
197
+ "sub_fields": [
198
+ {
199
+ "key": "<%= acf.fields.buttonsClone %>",
200
+ "label": "Buttons",
201
+ "name": "buttons",
202
+ "type": "clone",
203
+ "instructions": "",
204
+ "required": 0,
205
+ "conditional_logic": 0,
206
+ "wrapper": {
207
+ "width": "",
208
+ "class": "",
209
+ "id": ""
210
+ },
211
+ "clone": [
212
+ "group_5d10a747c1ff5"
213
+ ],
214
+ "display": "seamless",
215
+ "layout": "block",
216
+ "prefix_label": 0,
217
+ "prefix_name": 0
218
+ }
219
+ ]
220
+ },
221
+ {
222
+ "key": "<%= acf.fields.formTab %>",
223
+ "label": "Form",
224
+ "name": "",
225
+ "type": "tab",
226
+ "instructions": "",
227
+ "required": 0,
228
+ "conditional_logic": 0,
229
+ "wrapper": {
230
+ "width": "",
231
+ "class": "",
232
+ "id": ""
233
+ },
234
+ "placement": "top",
235
+ "endpoint": 0
236
+ },
237
+ {
238
+ "key": "<%= acf.fields.formGroup %>",
239
+ "label": "Form",
240
+ "name": "form",
241
+ "type": "group",
242
+ "instructions": "",
243
+ "required": 0,
244
+ "conditional_logic": 0,
245
+ "wrapper": {
246
+ "width": "",
247
+ "class": "",
248
+ "id": ""
249
+ },
250
+ "layout": "block",
251
+ "sub_fields": [
252
+ {
253
+ "key": "<%= acf.fields.formClone %>",
254
+ "label": "Form",
255
+ "name": "form",
256
+ "type": "clone",
257
+ "instructions": "",
258
+ "required": 0,
259
+ "conditional_logic": 0,
260
+ "wrapper": {
261
+ "width": "",
262
+ "class": "",
263
+ "id": ""
264
+ },
265
+ "clone": [
266
+ "group_5d1489f3b62ec"
267
+ ],
268
+ "display": "seamless",
269
+ "layout": "block",
270
+ "prefix_label": 0,
271
+ "prefix_name": 0
272
+ }
273
+ ]
274
+ },
275
+ {
276
+ "key": "<%= acf.fields.settingsTab %>",
277
+ "label": "Settings",
278
+ "name": "",
279
+ "type": "tab",
280
+ "instructions": "",
281
+ "required": 0,
282
+ "conditional_logic": 0,
283
+ "wrapper": {
284
+ "width": "",
285
+ "class": "",
286
+ "id": ""
287
+ },
288
+ "placement": "top",
289
+ "endpoint": 0
290
+ },
291
+ {
292
+ "key": "<%= acf.fields.backgroundGroup %>",
293
+ "label": "Background",
294
+ "name": "background",
295
+ "type": "group",
296
+ "instructions": "",
297
+ "required": 0,
298
+ "conditional_logic": 0,
299
+ "wrapper": {
300
+ "width": "",
301
+ "class": "",
302
+ "id": ""
303
+ },
304
+ "layout": "block",
305
+ "sub_fields": [
306
+ {
307
+ "key": "<%= acf.fields.backgroundClone %>",
308
+ "label": "Background",
309
+ "name": "background",
310
+ "type": "clone",
311
+ "instructions": "",
312
+ "required": 0,
313
+ "conditional_logic": 0,
314
+ "wrapper": {
315
+ "width": "",
316
+ "class": "",
317
+ "id": ""
318
+ },
319
+ "clone": [
320
+ "group_5d10cb5bb41ca"
321
+ ],
322
+ "display": "seamless",
323
+ "layout": "block",
324
+ "prefix_label": 0,
325
+ "prefix_name": 0
326
+ }
327
+ ]
328
+ }
329
+ ],
330
+ "location": [
331
+ [
332
+ {
333
+ "param": "block",
334
+ "operator": "==",
335
+ "value": "acf\/<%= name.slug %>"
336
+ }
337
+ ]
338
+ ],
339
+ "menu_order": 0,
340
+ "position": "normal",
341
+ "style": "default",
342
+ "label_placement": "top",
343
+ "instruction_placement": "label",
344
+ "hide_on_screen": "",
345
+ "active": 1,
346
+ "description": "",
347
+ "modified": <%= acf.timestamp %>
348
+ }
@@ -0,0 +1,547 @@
1
+ {
2
+ "key": "<%= acf.key %>",
3
+ "title": "Block: <%= name.title %>",
4
+ "fields": [
5
+ {
6
+ "key": "<%= acf.fields.headerTab %>",
7
+ "label": "Header",
8
+ "name": "",
9
+ "type": "tab",
10
+ "instructions": "",
11
+ "required": 0,
12
+ "conditional_logic": 0,
13
+ "wrapper": {
14
+ "width": "",
15
+ "class": "",
16
+ "id": ""
17
+ },
18
+ "placement": "left",
19
+ "endpoint": 0
20
+ },
21
+ {
22
+ "key": "<%= acf.fields.headerGroup %>",
23
+ "label": "Header",
24
+ "name": "header",
25
+ "type": "group",
26
+ "instructions": "",
27
+ "required": 0,
28
+ "conditional_logic": 0,
29
+ "wrapper": {
30
+ "width": "",
31
+ "class": "",
32
+ "id": ""
33
+ },
34
+ "layout": "block",
35
+ "sub_fields": [
36
+ {
37
+ "key": "<%= acf.fields.headerClone %>",
38
+ "label": "Header",
39
+ "name": "header",
40
+ "type": "clone",
41
+ "instructions": "",
42
+ "required": 0,
43
+ "conditional_logic": 0,
44
+ "wrapper": {
45
+ "width": "",
46
+ "class": "",
47
+ "id": ""
48
+ },
49
+ "clone": [
50
+ "group_5d10c6c72aa88"
51
+ ],
52
+ "display": "seamless",
53
+ "layout": "block",
54
+ "prefix_label": 0,
55
+ "prefix_name": 0
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ "key": "<%= acf.fields.textTab %>",
61
+ "label": "Text",
62
+ "name": "",
63
+ "type": "tab",
64
+ "instructions": "",
65
+ "required": 0,
66
+ "conditional_logic": 0,
67
+ "wrapper": {
68
+ "width": "",
69
+ "class": "",
70
+ "id": ""
71
+ },
72
+ "placement": "left",
73
+ "endpoint": 0
74
+ },
75
+ {
76
+ "key": "<%= acf.fields.showText %>",
77
+ "label": "Show text",
78
+ "name": "show_text",
79
+ "type": "true_false",
80
+ "instructions": "",
81
+ "required": 0,
82
+ "conditional_logic": 0,
83
+ "wrapper": {
84
+ "width": "",
85
+ "class": "",
86
+ "id": ""
87
+ },
88
+ "message": "",
89
+ "default_value": 0,
90
+ "ui": 1,
91
+ "ui_on_text": "",
92
+ "ui_off_text": ""
93
+ },
94
+ {
95
+ "key": "<%= acf.fields.textGroup %>",
96
+ "label": "Text",
97
+ "name": "text",
98
+ "type": "group",
99
+ "instructions": "",
100
+ "required": 0,
101
+ "conditional_logic": [
102
+ [
103
+ {
104
+ "field": "<%= acf.fields.showText %>",
105
+ "operator": "==",
106
+ "value": "1"
107
+ }
108
+ ]
109
+ ],
110
+ "wrapper": {
111
+ "width": "",
112
+ "class": "",
113
+ "id": ""
114
+ },
115
+ "layout": "block",
116
+ "sub_fields": [
117
+ {
118
+ "key": "<%= acf.fields.textClone %>",
119
+ "label": "Text",
120
+ "name": "text",
121
+ "type": "clone",
122
+ "instructions": "",
123
+ "required": 0,
124
+ "conditional_logic": 0,
125
+ "wrapper": {
126
+ "width": "",
127
+ "class": "",
128
+ "id": ""
129
+ },
130
+ "clone": [
131
+ "group_5d10c3212d211"
132
+ ],
133
+ "display": "seamless",
134
+ "layout": "block",
135
+ "prefix_label": 0,
136
+ "prefix_name": 0
137
+ }
138
+ ]
139
+ },
140
+ {
141
+ "key": "<%= acf.fields.columnsTab %>",
142
+ "label": "Columns",
143
+ "name": "",
144
+ "type": "tab",
145
+ "instructions": "",
146
+ "required": 0,
147
+ "conditional_logic": 0,
148
+ "wrapper": {
149
+ "width": "",
150
+ "class": "",
151
+ "id": ""
152
+ },
153
+ "placement": "left",
154
+ "endpoint": 0
155
+ },
156
+ {
157
+ "key": "<%= acf.fields.columnsRepeater %>",
158
+ "label": "Columns",
159
+ "name": "items",
160
+ "type": "repeater",
161
+ "instructions": "",
162
+ "required": 0,
163
+ "conditional_logic": 0,
164
+ "wrapper": {
165
+ "width": "",
166
+ "class": "",
167
+ "id": ""
168
+ },
169
+ "collapsed": "",
170
+ "min": 0,
171
+ "max": 0,
172
+ "layout": "block",
173
+ "button_label": "Add column",
174
+ "sub_fields": [
175
+ {
176
+ "key": "<%= acf.fields.columnsMediaTab %>",
177
+ "label": "Media",
178
+ "name": "",
179
+ "type": "tab",
180
+ "instructions": "",
181
+ "required": 0,
182
+ "conditional_logic": 0,
183
+ "wrapper": {
184
+ "width": "",
185
+ "class": "",
186
+ "id": ""
187
+ },
188
+ "placement": "top",
189
+ "endpoint": 0
190
+ },
191
+ {
192
+ "key": "<%= acf.fields.columnsMediaGroup %>",
193
+ "label": "Column media",
194
+ "name": "column_media",
195
+ "type": "group",
196
+ "instructions": "",
197
+ "required": 0,
198
+ "conditional_logic": 0,
199
+ "wrapper": {
200
+ "width": "",
201
+ "class": "",
202
+ "id": ""
203
+ },
204
+ "layout": "block",
205
+ "sub_fields": [
206
+ {
207
+ "key": "<%= acf.fields.columnsMediaClone %>",
208
+ "label": "Media",
209
+ "name": "media",
210
+ "type": "clone",
211
+ "instructions": "",
212
+ "required": 0,
213
+ "conditional_logic": 0,
214
+ "wrapper": {
215
+ "width": "",
216
+ "class": "",
217
+ "id": ""
218
+ },
219
+ "clone": [
220
+ "group_5dd2ebd632e0c"
221
+ ],
222
+ "display": "seamless",
223
+ "layout": "block",
224
+ "prefix_label": 0,
225
+ "prefix_name": 0
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "key": "<%= acf.fields.columnsTitleTab %>",
231
+ "label": "Title",
232
+ "name": "",
233
+ "type": "tab",
234
+ "instructions": "",
235
+ "required": 0,
236
+ "conditional_logic": 0,
237
+ "wrapper": {
238
+ "width": "",
239
+ "class": "",
240
+ "id": ""
241
+ },
242
+ "placement": "top",
243
+ "endpoint": 0
244
+ },
245
+ {
246
+ "key": "<%= acf.fields.columnsTitleGroup %>",
247
+ "label": "Column title",
248
+ "name": "column_title",
249
+ "type": "group",
250
+ "instructions": "",
251
+ "required": 0,
252
+ "conditional_logic": 0,
253
+ "wrapper": {
254
+ "width": "",
255
+ "class": "",
256
+ "id": ""
257
+ },
258
+ "layout": "block",
259
+ "sub_fields": [
260
+ {
261
+ "key": "<%= acf.fields.columnsTitleClone %>",
262
+ "label": "Title",
263
+ "name": "title",
264
+ "type": "clone",
265
+ "instructions": "",
266
+ "required": 0,
267
+ "conditional_logic": 0,
268
+ "wrapper": {
269
+ "width": "",
270
+ "class": "",
271
+ "id": ""
272
+ },
273
+ "clone": [
274
+ "group_5d10c483ebf4e"
275
+ ],
276
+ "display": "seamless",
277
+ "layout": "block",
278
+ "prefix_label": 0,
279
+ "prefix_name": 0
280
+ }
281
+ ]
282
+ },
283
+ {
284
+ "key": "<%= acf.fields.columnsTextTab %>",
285
+ "label": "Text",
286
+ "name": "",
287
+ "type": "tab",
288
+ "instructions": "",
289
+ "required": 0,
290
+ "conditional_logic": 0,
291
+ "wrapper": {
292
+ "width": "",
293
+ "class": "",
294
+ "id": ""
295
+ },
296
+ "placement": "top",
297
+ "endpoint": 0
298
+ },
299
+ {
300
+ "key": "<%= acf.fields.columnsTextGroup %>",
301
+ "label": "Column text",
302
+ "name": "column_text",
303
+ "type": "group",
304
+ "instructions": "",
305
+ "required": 0,
306
+ "conditional_logic": 0,
307
+ "wrapper": {
308
+ "width": "",
309
+ "class": "",
310
+ "id": ""
311
+ },
312
+ "layout": "block",
313
+ "sub_fields": [
314
+ {
315
+ "key": "<%= acf.fields.columnsTextClone %>",
316
+ "label": "Text",
317
+ "name": "text",
318
+ "type": "clone",
319
+ "instructions": "",
320
+ "required": 0,
321
+ "conditional_logic": 0,
322
+ "wrapper": {
323
+ "width": "",
324
+ "class": "",
325
+ "id": ""
326
+ },
327
+ "clone": [
328
+ "group_5d10c3212d211"
329
+ ],
330
+ "display": "seamless",
331
+ "layout": "block",
332
+ "prefix_label": 0,
333
+ "prefix_name": 0
334
+ }
335
+ ]
336
+ },
337
+ {
338
+ "key": "<%= acf.fields.columnsCtaTab %>",
339
+ "label": "CTA",
340
+ "name": "",
341
+ "type": "tab",
342
+ "instructions": "",
343
+ "required": 0,
344
+ "conditional_logic": 0,
345
+ "wrapper": {
346
+ "width": "",
347
+ "class": "",
348
+ "id": ""
349
+ },
350
+ "placement": "top",
351
+ "endpoint": 0
352
+ },
353
+ {
354
+ "key": "<%= acf.fields.columnsCtaGroup %>",
355
+ "label": "Column CTA",
356
+ "name": "column_cta",
357
+ "type": "group",
358
+ "instructions": "",
359
+ "required": 0,
360
+ "conditional_logic": 0,
361
+ "wrapper": {
362
+ "width": "",
363
+ "class": "",
364
+ "id": ""
365
+ },
366
+ "layout": "block",
367
+ "sub_fields": [
368
+ {
369
+ "key": "<%= acf.fields.columnsCtaClone %>",
370
+ "label": "CTA",
371
+ "name": "cta",
372
+ "type": "clone",
373
+ "instructions": "",
374
+ "required": 0,
375
+ "conditional_logic": 0,
376
+ "wrapper": {
377
+ "width": "",
378
+ "class": "",
379
+ "id": ""
380
+ },
381
+ "clone": [
382
+ "group_5d10a747c1ff5"
383
+ ],
384
+ "display": "seamless",
385
+ "layout": "block",
386
+ "prefix_label": 0,
387
+ "prefix_name": 0
388
+ }
389
+ ]
390
+ }
391
+ ]
392
+ },
393
+ {
394
+ "key": "<%= acf.fields.buttonsTab %>",
395
+ "label": "Buttons below columns",
396
+ "name": "",
397
+ "type": "tab",
398
+ "instructions": "",
399
+ "required": 0,
400
+ "conditional_logic": 0,
401
+ "wrapper": {
402
+ "width": "",
403
+ "class": "",
404
+ "id": ""
405
+ },
406
+ "placement": "left",
407
+ "endpoint": 0
408
+ },
409
+ {
410
+ "key": "<%= acf.fields.showButtons %>",
411
+ "label": "Show buttons",
412
+ "name": "show_buttons",
413
+ "type": "true_false",
414
+ "instructions": "",
415
+ "required": 0,
416
+ "conditional_logic": 0,
417
+ "wrapper": {
418
+ "width": "",
419
+ "class": "",
420
+ "id": ""
421
+ },
422
+ "message": "",
423
+ "default_value": 0,
424
+ "ui": 1,
425
+ "ui_on_text": "",
426
+ "ui_off_text": ""
427
+ },
428
+ {
429
+ "key": "<%= acf.fields.buttonsGroup %>",
430
+ "label": "Buttons",
431
+ "name": "buttons",
432
+ "type": "group",
433
+ "instructions": "",
434
+ "required": 0,
435
+ "conditional_logic": [
436
+ [
437
+ {
438
+ "field": "<%= acf.fields.showButtons %>",
439
+ "operator": "==",
440
+ "value": "1"
441
+ }
442
+ ]
443
+ ],
444
+ "wrapper": {
445
+ "width": "",
446
+ "class": "",
447
+ "id": ""
448
+ },
449
+ "layout": "block",
450
+ "sub_fields": [
451
+ {
452
+ "key": "<%= acf.fields.buttonsClone %>",
453
+ "label": "Buttons",
454
+ "name": "buttons",
455
+ "type": "clone",
456
+ "instructions": "",
457
+ "required": 0,
458
+ "conditional_logic": 0,
459
+ "wrapper": {
460
+ "width": "",
461
+ "class": "",
462
+ "id": ""
463
+ },
464
+ "clone": [
465
+ "group_5d10a747c1ff5"
466
+ ],
467
+ "display": "seamless",
468
+ "layout": "block",
469
+ "prefix_label": 0,
470
+ "prefix_name": 0
471
+ }
472
+ ]
473
+ },
474
+ {
475
+ "key": "<%= acf.fields.settingsTab %>",
476
+ "label": "Settings",
477
+ "name": "",
478
+ "type": "tab",
479
+ "instructions": "",
480
+ "required": 0,
481
+ "conditional_logic": 0,
482
+ "wrapper": {
483
+ "width": "",
484
+ "class": "",
485
+ "id": ""
486
+ },
487
+ "placement": "left",
488
+ "endpoint": 0
489
+ },
490
+ {
491
+ "key": "<%= acf.fields.backgroundGroup %>",
492
+ "label": "Background",
493
+ "name": "background",
494
+ "type": "group",
495
+ "instructions": "",
496
+ "required": 0,
497
+ "conditional_logic": 0,
498
+ "wrapper": {
499
+ "width": "",
500
+ "class": "",
501
+ "id": ""
502
+ },
503
+ "layout": "block",
504
+ "sub_fields": [
505
+ {
506
+ "key": "<%= acf.fields.backgroundClone %>",
507
+ "label": "Background",
508
+ "name": "background",
509
+ "type": "clone",
510
+ "instructions": "",
511
+ "required": 0,
512
+ "conditional_logic": 0,
513
+ "wrapper": {
514
+ "width": "",
515
+ "class": "",
516
+ "id": ""
517
+ },
518
+ "clone": [
519
+ "group_5d10cb5bb41ca"
520
+ ],
521
+ "display": "seamless",
522
+ "layout": "block",
523
+ "prefix_label": 0,
524
+ "prefix_name": 0
525
+ }
526
+ ]
527
+ }
528
+ ],
529
+ "location": [
530
+ [
531
+ {
532
+ "param": "block",
533
+ "operator": "==",
534
+ "value": "acf\/<%= name.slug %>"
535
+ }
536
+ ]
537
+ ],
538
+ "menu_order": 0,
539
+ "position": "normal",
540
+ "style": "default",
541
+ "label_placement": "top",
542
+ "instruction_placement": "label",
543
+ "hide_on_screen": "",
544
+ "active": 1,
545
+ "description": "",
546
+ "modified": <%= acf.timestamp %>
547
+ }
@@ -1,8 +1,8 @@
1
- <%_ if (answers.blockDescription) { _%>
2
1
  {{--
2
+ Title: <%= name.title %>
3
3
  Description: <%= answers.blockDescription %>
4
+ Keywords: <%= name.noCase %>
4
5
  --}}
5
- <% } _%>
6
6
  @block([ 'block' => $block ])
7
7
 
8
8
  @endblock
@@ -0,0 +1,20 @@
1
+ {{--
2
+ Title: <%= name.title %>
3
+ Description: <%= answers.blockDescription %>
4
+ Keywords: <%= name.noCase %>
5
+ --}}
6
+ @block([ 'block' => $block ])
7
+ @background( $background )
8
+ <div class="container">
9
+ <div class="row">
10
+ <div class="col">
11
+ @sectionheader( $section_header )@endsectionheader
12
+ @text( $text )@endtext
13
+ @media( $media )@endmedia
14
+ @buttoncollection( $buttons )@endbuttoncollection
15
+ @form( $form )@endform
16
+ </div>
17
+ </div>
18
+ </div>
19
+ @endbackground
20
+ @endblock
@@ -0,0 +1,52 @@
1
+ {{--
2
+ Title: <%= name.title %>
3
+ Description: <%= answers.blockDescription %>
4
+ Keywords: <%= name.noCase %>
5
+ --}}
6
+ @block([ 'block' => $block ])
7
+ @background( $background )
8
+ <div class="container">
9
+ <div class="b-building-repeater-block__inner">
10
+ <div class="b-building-repeater-block__head">
11
+ @sectionheader( $header )@endsectionheader
12
+ @if( $show_text )
13
+ @text( $text )@endtext
14
+ @endif
15
+ </div>
16
+ <div class="b-building-repeater-block__body">
17
+ <div class="b-building-repeater-block__items">
18
+ <div class="b-building-repeater-block__row row"
19
+ data-af-eq-items=".b-building-repeater-block__item-title, .b-building-repeater-block__item-text"
20
+ data-af-eq-group-by="720: 2, 1280: 3, 1680: 2"
21
+ >
22
+ @foreach( $items as $item )
23
+ <div class="b-building-repeater-block__item col-12 col-md-6 col-lg">
24
+ <div class="b-building-repeater-block__item-wrap">
25
+ @media(
26
+ $item[ 'column_media' ] + [ 'class' => 'b-building-repeater-block__item-media' ]
27
+ )@endmedia
28
+ @title(
29
+ $item[ 'column_title' ] + [ 'class' => 'b-building-repeater-block__item-title' ]
30
+ )@endtitle
31
+ @text(
32
+ $item[ 'column_text' ] + [ 'class' => 'b-building-repeater-block__item-text' ]
33
+ )@endtext
34
+ @buttoncollection(
35
+ $item[ 'column_cta' ]
36
+ + [ 'container_class' => 'b-building-repeater-block__item-cta' ]
37
+ )@endbuttoncollection
38
+ </div>
39
+ </div>
40
+ @endforeach
41
+ </div>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ @if( $show_buttons )
46
+ <div class="b-building-repeater-block__footer">
47
+ @buttoncollection( $buttons )@endbuttoncollection
48
+ </div>
49
+ @endif
50
+ </div>
51
+ @endbackground
52
+ @endblock
@@ -52,7 +52,7 @@ export default class extends Generator {
52
52
 
53
53
  this.answers = await this.prompt(prompts);
54
54
  this.name = nameCases(this.answers.componentName);
55
- this.acf = acfData({ prefix: "group_" });
55
+ this.acf = acfData();
56
56
  this.data = {
57
57
  answers: this.answers,
58
58
  name: this.name,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@airfleet/generator-init",
3
3
  "description": "A Yeoman generator to scaffold common Airfleet features",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "scripts": {},
6
6
  "publishConfig": {
7
7
  "access": "public"
package/utils/acfData.js CHANGED
@@ -1,9 +1,12 @@
1
1
  import { uniqid } from "locutus/php/misc/index.js";
2
2
  import { time } from "locutus/php/datetime/index.js";
3
3
 
4
- export default function acfData({ prefix }) {
4
+ export default function acfData(options = {}) {
5
5
  return {
6
- key: uniqid(prefix),
6
+ key: uniqid("group_"),
7
7
  timestamp: time(),
8
+ fields: Object.fromEntries(
9
+ (options.fields || []).map((key) => [key, uniqid("field_")])
10
+ ),
8
11
  };
9
12
  }
@@ -1,4 +1,4 @@
1
- import { camelCase, paramCase, pascalCase } from "change-case";
1
+ import { camelCase, noCase, paramCase, pascalCase } from "change-case";
2
2
  import { titleCase } from "title-case";
3
3
 
4
4
  export default function nameCases(name) {
@@ -17,5 +17,8 @@ export default function nameCases(name) {
17
17
 
18
18
  // "Test String"
19
19
  title: titleCase(name),
20
+
21
+ // "test string"
22
+ noCase: noCase(name),
20
23
  };
21
24
  }