Replies: 2 comments
-
|
This may help with other field names. We can create a single field name for the teacher, and based on where it was placed in the editor, it will know it was used on the teacher's detailed view on row 3. This could reduce the code needed to create content. |
Beta Was this translation helpful? Give feedback.
-
Planning NotesUnified Element Names (from @bcordis comment)Instead of prefixed duplicates ( This collapses ~2,500 lines of template.xml into a compact array structure and naturally supports repeatable elements. Proposed Storage FormatStore elements as a JSON array in a single {
"layout_elements": {
"messages": [
{ "name": "scripture1", "row": 1, "col": 1, "colspan": 2, "element": "p", "class": "", "link": 0 },
{ "name": "title", "row": 1, "col": 3, "colspan": 4, "element": "h3", "class": "", "link": 1 },
{ "name": "spacer", "row": 2, "col": 1, "colspan": 0, "element": "div", "class": "my-3" },
{ "name": "spacer", "row": 4, "col": 1, "colspan": 0, "element": "div", "class": "border-bottom" }
],
"details": [],
"teachers": []
}
}Joomla form-filter ProblemThe biggest technical challenge:
Option 1 is simplest and already proven (Layout Editor Migration Path
Rendering Engine ChangesCurrent approach uses a fixed switch/case with ~50 cases. Proposed approach uses an element renderer registry where each element name maps to a render function. The renderer receives the item data and element config, and the framework wraps the output in the chosen HTML tag and CSS class. Repeatable elements (spacer, custom) just appear multiple times in the array. Effort Estimate
RecommendationThis is a v11.0 candidate — it is a breaking change to template params storage. The current spacer1/2/3 workaround is sufficient for v10.x. Plan and prototype on a research branch. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
The current Layout Editor uses fixed, named fields in
template.xmlfor each element (e.g.,spacer1row,spacer2row,spacer3row). This means:Proposal
Allow dynamic creation of repeatable elements (spacers, custom fields) in the Layout Editor without pre-defined XML fields.
Key design questions
Storage format — How to store N dynamic elements in Joomla's params JSON?
spacers: [{row: 2, col: 1, class: "my-3"}, ...])spacer_1_row,spacer_2_row, dynamically generated)Form rendering — How to show add/remove controls in the Layout Editor?
AdminModel::save()→form->filter()stripping (the hidden field requirement)Rendering engine —
Cwmlisting::getListingBody()uses a fixed switch/case for element namesstr_starts_with($name, spacer)) instead of exact matchMigration — Existing templates with
spacer1/spacer2/spacer3need to continue workingWhich elements should be repeatable?
Scope
This would be a significant refactor of the template params architecture. Worth planning carefully before implementing.
Related
template.xmlhidden field requirement forsyncToForm()Beta Was this translation helpful? Give feedback.
All reactions