Skip to content

Commit 409b802

Browse files
authored
Add support for "allowLayoutOverrides" in Drupal recipes (SchemaStore#5549)
This change introduces a schema definition for the "allowLayoutOverrides" config action for "core.entity_view_display.\*.\*.\*" entities. It accepts a boolean value (`true` to allow overrides, `false` to disallow). This change may seem more narrowly-scoped than appropriate since the upstream change[^1] also introduced new "enableLayoutBuilder" and "disableLayoutBuilder" actions; however, there is no precedent for how to define schema for parameter-less actions, and I would prefer to let the project's upstream maintainers establish that precedent. [^1]: [Issue #3486981 by phenaproxima, thejimbirch: Allow recipes to enable Layout Builder via config actions](https://git.drupalcode.org/project/drupal/-/commit/524cf737ec1284471552fb632bb833b2d25b5fd1)
1 parent 1b391de commit 409b802

File tree

2 files changed

+126
-61
lines changed

2 files changed

+126
-61
lines changed

src/schemas/json/drupal-recipe.json

Lines changed: 125 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,73 @@
4848
},
4949
"actionsList": {
5050
"generic": {
51+
"hideComponent": {
52+
"type": "string",
53+
"title": "Hides a component from an entity view display or entity form display.",
54+
"description": "Value: The component id",
55+
"default": "uid"
56+
},
57+
"hideComponents": {
58+
"type": "array",
59+
"description": "Value: The list of component ids",
60+
"items": [
61+
{
62+
"type": "string"
63+
}
64+
]
65+
},
66+
"setComponent": {
67+
"type": "object",
68+
"description": "Allows adding a field to an entity's view or form displays.",
69+
"properties": {
70+
"name": {
71+
"description": "The field id. i.e. field_tags",
72+
"type": "string"
73+
},
74+
"options": {
75+
"type": "object",
76+
"properties": {
77+
"type": {
78+
"description": "The field type. i.e. entity_reference_label",
79+
"type": "string"
80+
},
81+
"label": {
82+
"description": "Label position. i.e. above",
83+
"type": "string",
84+
"enum": ["above", "below", "hidden", "inline"]
85+
},
86+
"settings": {
87+
"type": "object",
88+
"properties": {
89+
"link": {
90+
"type": "boolean"
91+
}
92+
}
93+
},
94+
"third_party_settings": {
95+
"type": "object"
96+
},
97+
"weight": {
98+
"type": "number"
99+
},
100+
"region": {
101+
"$ref": "#/$defs/theme/defaultRegions",
102+
"type": "string"
103+
}
104+
}
105+
}
106+
},
107+
"additionalProperties": false
108+
},
109+
"setComponents": {
110+
"type": "array",
111+
"description": "Allows adding adding the configuration for multiple fields.",
112+
"items": [
113+
{
114+
"$ref": "#/$defs/actionsList/generic/setComponent"
115+
}
116+
]
117+
},
51118
"cloneAs": {
52119
"description": "Creates a clone of any config entity with a new ID.",
53120
"type": "string"
@@ -222,75 +289,20 @@
222289
"core.entity_form_display.*.*.*": {
223290
"$comment": "",
224291
"type": "object",
225-
"title": "Form/View display",
292+
"title": "Form display",
226293
"description": "",
227294
"properties": {
228295
"hideComponent": {
229-
"type": "string",
230-
"title": "Hides a component from an entity view display or entity form display.",
231-
"description": "Value: The component id",
232-
"default": "uid"
296+
"$ref": "#/$defs/actionsList/generic/hideComponent"
233297
},
234298
"hideComponents": {
235-
"type": "array",
236-
"description": "Value: The list of component ids",
237-
"items": [
238-
{
239-
"type": "string"
240-
}
241-
]
299+
"$ref": "#/$defs/actionsList/generic/hideComponents"
242300
},
243301
"setComponent": {
244-
"type": "object",
245-
"description": "Allows adding a field to an entity's view or form displays.",
246-
"properties": {
247-
"name": {
248-
"description": "The field id. i.e. field_tags",
249-
"type": "string"
250-
},
251-
"options": {
252-
"type": "object",
253-
"properties": {
254-
"type": {
255-
"description": "The field type. i.e. entity_reference_label",
256-
"type": "string"
257-
},
258-
"label": {
259-
"description": "Label position. i.e. above",
260-
"type": "string",
261-
"enum": ["above", "below", "hidden", "inline"]
262-
},
263-
"settings": {
264-
"type": "object",
265-
"properties": {
266-
"link": {
267-
"type": "boolean"
268-
}
269-
}
270-
},
271-
"third_party_settings": {
272-
"type": "object"
273-
},
274-
"weight": {
275-
"type": "number"
276-
},
277-
"region": {
278-
"$ref": "#/$defs/theme/defaultRegions",
279-
"type": "string"
280-
}
281-
}
282-
}
283-
},
284-
"additionalProperties": false
302+
"$ref": "#/$defs/actionsList/generic/setComponent"
285303
},
286304
"setComponents": {
287-
"type": "array",
288-
"description": "Allows adding adding the configuration for multiple fields.",
289-
"items": [
290-
{
291-
"$ref": "#/$defs/actionsList/specific/core.entity_form_display.*.*.*/properties/setComponent"
292-
}
293-
]
305+
"$ref": "#/$defs/actionsList/generic/setComponents"
294306
},
295307
"cloneAs": {
296308
"$ref": "#/$defs/actionsList/generic/cloneAs"
@@ -326,7 +338,59 @@
326338
"additionalProperties": false
327339
},
328340
"core.entity_view_display.*.*.*": {
329-
"$ref": "#/$defs/actionsList/specific/core.entity_form_display.*.*.*"
341+
"$comment": "",
342+
"type": "object",
343+
"title": "Form display",
344+
"description": "",
345+
"properties": {
346+
"allowLayoutOverrides": {
347+
"type": "boolean",
348+
"title": "Sets whether layout builder overrides are allowed."
349+
},
350+
"hideComponent": {
351+
"$ref": "#/$defs/actionsList/generic/hideComponent"
352+
},
353+
"hideComponents": {
354+
"$ref": "#/$defs/actionsList/generic/hideComponents"
355+
},
356+
"setComponent": {
357+
"$ref": "#/$defs/actionsList/generic/setComponent"
358+
},
359+
"setComponents": {
360+
"$ref": "#/$defs/actionsList/generic/setComponents"
361+
},
362+
"cloneAs": {
363+
"$ref": "#/$defs/actionsList/generic/cloneAs"
364+
},
365+
"create": {
366+
"$ref": "#/$defs/actionsList/generic/create"
367+
},
368+
"createIfNotExists": {
369+
"$ref": "#/$defs/actionsList/generic/createIfNotExists"
370+
},
371+
"createForEach": {
372+
"$ref": "#/$defs/actionsList/generic/createForEach"
373+
},
374+
"createForEachIfNotExists": {
375+
"$ref": "#/$defs/actionsList/generic/createForEachIfNotExists"
376+
},
377+
"set": {
378+
"$ref": "#/$defs/actionsList/generic/set"
379+
},
380+
"setMultiple": {
381+
"$ref": "#/$defs/actionsList/generic/setMultiple"
382+
},
383+
"setThirdPartySetting": {
384+
"$ref": "#/$defs/actionsList/generic/setThirdPartySetting"
385+
},
386+
"setThirdPartySettings": {
387+
"$ref": "#/$defs/actionsList/generic/setThirdPartySettings"
388+
},
389+
"simpleConfigUpdate": {
390+
"$ref": "#/$defs/actionsList/generic/simpleConfigUpdate"
391+
}
392+
},
393+
"additionalProperties": false
330394
},
331395
"contact.form.*": {
332396
"type": "object",

src/test/drupal-recipe/drupal-recipe.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ config:
263263
- module: layout_builder
264264
key: enabled
265265
value: false
266+
allowLayoutOverrides: true
266267
contact.form.feedback:
267268
createIfNotExists:
268269
langcode: es

0 commit comments

Comments
 (0)