Hello,
When using Global field Render Entity : Site Settings in views, an ID must be set to reference the Site Settings entity you want to display. Fine.
But I found that if you sync your config from a local dev to a staging website, it is not the node ID that is saved in the views .yml but the UUID and it is not the same from one website to another. It is true that the node ID could also not be the same...
So I think, has for the block, it could be a good idea to use a machine name to identify the Site Settings entity in views, and this way it stays the same from a website to another.
Thank you for your attention and time
David.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 3046958-feature-demo.mp4 | 11.3 MB | id.conky |
Issue fork site_settings-3046958
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
anouComment #3
anouMaybe this issue is the "why" we do not have, and also maybe the solution to have, a machine name for custom entity: https://www.drupal.org/project/drupal/issues/2685749
I also do not understand why we fill the text field with the ID and the views record is with the UUID ?
Comment #4
scott_euser commentedThis makes sense! Would be happy if anyone is willing to contribute a patch with appropriate hook updates
Comment #6
id.conky commentedComment #10
id.conky commentedRewriting/altering core's Entity area plugin (Rendered entity - Site Setting) not reasonable, as it mainly depends on EntityRepositoryInterface::loadEntityByConfigTarget and EntityInterface::getConfigTarget which are hardcoded to use uuid.
I decided to resolve that another way by creating completely new plugin which have configurable site settings bundle and render all entities with selected view mode.
Regarding hook updates - I don't like the idea to force migrate users who use core solution with hardcoded entity id's as this definetly will break something, especially when site setting type have "Multiple" option enabled.
My test view with that plugin exports to configs like that:
Need community/maintainer testing & review.
Comment #11
scott_euser commentedThanks Bogdan (and nice to see you again!). Could you add a screenshot of what/where you mean so I can understand what to check better?
Thanks,
Scott
Comment #12
id.conky commentedHey Scott,
Thanks for reply and nice to see you too :)
I've attached video with demo of new plugin for views area that add's ability to render site setting entities in any region like header, empty results, etc.
The configuration is pretty simple - just select site setting type and it will render all entities from that bundle.
The difference beteen core solution that under the hood it store site setting bundle id, so when feature deployed across different environments the ID linking doesn't become broken (as mentioned in issue description).
That trick would work just fine in scenarios when only one site setting enity exists in selected type.
As an adition - maybe it make sense to add ability to choose site settings by group in configuration form?
Comment #13
scott_euser commentedThanks! I gave this a test run and can see on config import that the `entity_site_setting_entity` hits the uuid whereas the `rendered_site_settings` now doesn't care about the entity being the same in local or prod but bases it on the site setting type itself now. So LGTM!
Comment #15
scott_euser commented