You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add ALTER PAGE SET Layout to switch page layout (#54)
Adds SET Layout = Module.LayoutName [MAP (Old AS New)] to ALTER PAGE.
Rewrites FormCall.Form and Parameter strings without rebuilding the
widget tree. Auto-maps placeholders by name; explicit MAP clause for
layouts with different placeholder names. Not supported for snippets.
Full pipeline: grammar, AST, visitor, executor, plus docs (quick
reference, language guide, reference page, examples, skills, CLAUDE.md)
and doctype-test examples.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/skills/mendix/alter-page.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,7 @@ SET Title = 'New Page Title'
64
64
|`Visible`| Any widget | String or Boolean |`SET Visible = false ON txtHidden`|
65
65
|`Name`| Any widget | String |`SET Name = 'newName' ON oldName`|
66
66
|`Title`| Page-level only | String |`SET Title = 'Edit Customer'`|
67
+
|`Layout`| Page-level only | Qualified name |`SET Layout = Atlas_Core.Atlas_Default`|
67
68
|`'quotedProp'`| Pluggable widgets | String, Boolean, Number |`SET 'showLabel' = false ON cbStatus`|
68
69
69
70
**Pluggable widget properties** use quoted names to set values in the widget's `Object.Properties[]`. Boolean values are stored as `"yes"`/`"no"` in BSON.
@@ -139,6 +140,20 @@ DROP Variables $showStockColumn
139
140
140
141
Removes a page variable by name.
141
142
143
+
### SET Layout - Change Page Layout
144
+
145
+
```sql
146
+
-- Auto-map placeholders by name (most common case)
147
+
SET Layout =Atlas_Core.Atlas_Default
148
+
149
+
-- Explicit mapping when placeholder names differ
150
+
SET Layout =Atlas_Core.Atlas_SideBar MAP (Main AS Content, Extra AS Sidebar)
151
+
```
152
+
153
+
Changes the page's layout without rebuilding the widget tree. Only rewrites the `FormCall.Form` and `FormCall.Arguments[].Parameter` BSON fields — all widget content is preserved. Not supported for snippets.
154
+
155
+
When placeholders have the same names in both layouts (e.g., both have `Main`), auto-mapping works. Use `MAP` when placeholder names differ between the old and new layout.
Copy file name to clipboardExpand all lines: docs-site/src/language/alter-page.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,26 @@ ALTER PAGE Module.EditPage {
67
67
};
68
68
```
69
69
70
+
### SET Layout -- Change Page Layout
71
+
72
+
Switch a page's layout without rebuilding the widget tree. All widget content is preserved -- only the layout reference and placeholder mappings are updated.
73
+
74
+
```sql
75
+
-- Auto-map placeholders by name (common case)
76
+
ALTER PAGE Module.EditPage {
77
+
SET Layout =Atlas_Core.Atlas_Default
78
+
};
79
+
80
+
-- Explicit mapping when placeholder names differ
81
+
ALTER PAGE Module.EditPage {
82
+
SET Layout =Atlas_Core.Atlas_SideBar MAP (Main AS Content, Extra AS Sidebar)
83
+
};
84
+
```
85
+
86
+
When both the old and new layouts share the same placeholder names (e.g., both have `Main`), no `MAP` clause is needed -- placeholders are matched automatically. Use `MAP` when the new layout has different placeholder names.
87
+
88
+
Not supported for snippets (snippets don't have layouts).
89
+
70
90
### INSERT -- Add Widgets
71
91
72
92
Insert new widgets before or after an existing widget:
-- Change page layout (auto-map placeholders by name)
45
+
SET Layout =module.LayoutName;
46
+
47
+
-- Change layout with explicit placeholder mapping
48
+
SET Layout =module.LayoutName MAP (OldPlaceholder AS NewPlaceholder);
43
49
```
44
50
45
51
## Description
@@ -70,6 +76,12 @@ Removes one or more widgets by name. The widget and all its children are removed
70
76
71
77
Replaces a widget (and its entire subtree) with one or more new widgets.
72
78
79
+
### SET Layout
80
+
81
+
Changes the page's layout without rebuilding the widget tree. Placeholder names are auto-mapped by default. If the new layout has different placeholder names, use `MAP` to specify the mapping.
82
+
83
+
Not supported for snippets (snippets don't have layouts).
84
+
73
85
### ADD Variables / DROP Variables
74
86
75
87
Adds or removes page-level variables. Page variables are typed values with default expressions, available for conditional visibility and dynamic behavior.
@@ -148,6 +160,22 @@ ALTER PAGE Sales.Order_Edit {
148
160
};
149
161
```
150
162
163
+
Change page layout (preserves all widgets):
164
+
165
+
```sql
166
+
ALTER PAGE Sales.Order_Edit {
167
+
SET Layout =Atlas_Core.Atlas_Default;
168
+
};
169
+
```
170
+
171
+
Change layout with explicit placeholder mapping:
172
+
173
+
```sql
174
+
ALTER PAGE Sales.Order_Edit {
175
+
SET Layout =Atlas_Core.Atlas_SideBar MAP (Main AS Content, Extra AS Sidebar);
0 commit comments