- Issue created by @wim leers
- Merge request !347#3478537: Introduce an XB `PageTemplate` config entity โ (Merged) created by wim leers
- ๐ธ๐ชSweden johnwebdev
I have a question that Iโve been thinking about around this, maybe a bit early to answer
Letโs say I have a header region, and I place a Hero component in that region. The Hero component an background image (Media entity)
How will that work? Letโs say I build the page template locally and then push the config entity to production, there is no guarantee that the media with that ID exists so the default will be broken image when you create a page.
Thinking loudlyโฆ Should page templates e.g be allowed to save โincompleteโ components, or do we need some placeholder feature generic, or specifically for media?
- ๐บ๐ธUnited States effulgentsia
wim leers โ credited effulgentsia โ .
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This is progressing nicely. An incomplete
PageTemplate
config entity now fails as expected:1) Drupal\Tests\experience_builder\Kernel\Config\PageTemplateValidationTest::testEntityIsValid Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ -Array &0 [] +Array &0 [ + 'component_trees' => Array &1 [ + 0 => 'Configuration for the region "<em class="placeholder">sidebar_first</em>" (<em class="placeholder">sidebar_first</em>) is missing.', + 1 => 'Configuration for the region "<em class="placeholder">sidebar_second</em>" (<em class="placeholder">sidebar_second</em>) is missing.', + 2 => 'Configuration for the region "<em class="placeholder">content</em>" (<em class="placeholder">content</em>) is missing.', + 3 => 'Configuration for the region "<em class="placeholder">header</em>" (<em class="placeholder">header</em>) is missing.', + 4 => 'Configuration for the region "<em class="placeholder">primary_menu</em>" (<em class="placeholder">primary_menu</em>) is missing.', + 5 => 'Configuration for the region "<em class="placeholder">secondary_menu</em>" (<em class="placeholder">secondary_menu</em>) is missing.', + 6 => 'Configuration for the region "<em class="placeholder">footer</em>" (<em class="placeholder">footer</em>) is missing.', + 7 => 'Configuration for the region "<em class="placeholder">highlighted</em>" (<em class="placeholder">highlighted</em>) is missing.', + 8 => 'Configuration for the region "<em class="placeholder">help</em>" (<em class="placeholder">help</em>) is missing.', + 9 => 'Configuration for the region "<em class="placeholder">page_top</em>" (<em class="placeholder">page_top</em>) is missing.', + 10 => 'Configuration for the region "<em class="placeholder">page_bottom</em>" (<em class="placeholder">page_bottom</em>) is missing.', + 11 => 'Configuration for the region "<em class="placeholder">breadcrumb</em>" (<em class="placeholder">breadcrumb</em>) is missing.', + ], +]
(Also crediting Lauri & Alex.)
- ๐ฌ๐งUnited Kingdom catch
How will that work? Letโs say I build the page template locally and then push the config entity to production, there is no guarantee that the media with that ID exists so the default will be broken image when you create a page.
The way this works with similar things now is you would have to do this:
1. Create the media entity on production
2. Sync the production database locally
3. Set up the layout (or whatever config entity referencing the content entity).
4. Deploy the config and everything worksThis works but is of course very clunky. Feels like a separate issue since it's more of a general problem with config entities that reference config entities rather than XB specific, although agreed it's going to be a common thing people want to do.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
#3: @catch is right in #7 and is also right that this is out of scope here, but merits its own issue. For now, let's discuss this on the meta, because this is a challenge affecting multiple of XB's config entity types. See prior discussion at #3444424-4: [META] Configuration management: define needed config entity types โ from >4 months ago, where I link to a PoC that we built >5 months ago that shows a viable way to fix that.
Let's not discuss that further here ๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Will continue on Monday, but this is ready for an initial high-level review. ๐
- First commit to issue fork.
- ๐ฌ๐งUnited Kingdom longwave UK
A few questions but mostly nits, I think the overall approach is sound.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@lauriii A review from @longwave surfaced two important questions, and I answered both by adding explicit "warning, future stuff" docs for both. Can you confirm the accuracy of these 2 small paragraphs? ๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks @lauriii! Incorporated your suggested refinement too ๐
All feedback from @longwave has now been addressed, back to him for review.
- ๐ฌ๐งUnited Kingdom catch
I did a (fairly quick/cursory) review of this and couldn't see any obvious problems, just one question in the MR.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Good question/suggestion, @catch! Responded :)
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
The HTTP API follow-up exists: ๐ HTTP API to read+write PageTemplate and Pattern config entities Active .
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Merged in upstream and did a trivial search-and-replace to compensate for ๐ Replace plus with dot in component config entity IDs Active having landed.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
FYI: ๐ HTTP API to read+write PageTemplate and Pattern config entities Active is making good progress and will allow a (client-side) UI to be built, allowing to reuse significant pieces of the existing UX :)
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Follow-up created per @lauriii's feedback: ๐ [later phase] [PP-1] Gracefully handle deleted regions in PageTemplate config entities" Postponed .
- ๐ฌ๐งUnited Kingdom longwave UK
Again only another round of tiny nits, I still think this is a solid base for the desired functionality here.
- ๐ฌ๐งUnited Kingdom longwave UK
Thanks, this looks great now, and unblocks future work. Let's ship it!
-
wim leers โ
committed f1e3abde on 0.x
Issue #3478537 by wim leers, longwave, lauriii, catch, effulgentsia:...
-
wim leers โ
committed f1e3abde on 0.x
Automatically closed - issue fixed for 2 weeks with no activity.