Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
From #2628168-2: Clean up Entity Embed's data model:
Also note that data-entity-embed-settings contains the settings specific to the selected display (data-entity-embed-display), therefore this is actually currently misnamed: data-entity-embed-display-settings would make much more sense.
Proposed resolution
Rename data-entity-embed-settings
attribute to data-entity-embed-display-settings
. Make sure BC layer is implemented:
- Entity embed filter should work with both
- Entity embed button should recognize both but only save new attribute
We should test BC layer where possible (text filter).
Comment | File | Size | Author |
---|---|---|---|
#12 | 2760801_12.patch | 31.6 KB | slashrsm |
| |||
#12 | interdiff.txt | 830 bytes | slashrsm |
#10 | rename-2760801-10.patch | 31.22 KB | thenchev |
#10 | interdiff-2760801-10.txt | 6.39 KB | thenchev |
#7 | rename-2760801-7.patch | 30.89 KB | thenchev |
Comments
Comment #2
slashrsm CreditAttribution: slashrsm at MD Systems GmbH for Acquia commentedComment #3
thenchev CreditAttribution: thenchev at MD Systems GmbH for Acquia commentedSo renamed all occurrences of data-entity-embed-display added test to se if it still works with the old attribute.
Tested it manually with -
display as label that is linked. The entity is shown with both new and old attributes and the button seems to recognize the old attribute and changes it to the new on save.
Looks like it works for me but would like a second opinion.
Do we need more test coverage?
Comment #4
slashrsm CreditAttribution: slashrsm at MD Systems GmbH for Acquia commentedFix wrapping.
Comment #5
Dave ReidI'm going to push back on this one. Yes it contains display settings, but I also envisioned it being used to store additional things like "Override the node title or field X value when embedded here", which isn't necessarily related to display, but rather the embed itself. I think this changes the data structure unnecessarily. This change mostly seems to be about semantics, so unless there is a more compelling argument, I think this should be won't fixed in a week.
Comment #6
slashrsm CreditAttribution: slashrsm at MD Systems GmbH for Acquia commentedI thought that we agreed in the past that having data structures where we throw anything that comes to mind isn't the way to go. Having responsibilities clearly separated has been a guideline for a while and is also a general best practice.
Could a tool that allows overriding of certain fields/data use its own attribute? Is there an issue for that where we could discuss the architecture? Has any development work been done with regards to that? It is impossible to plan further development and roadmap if we do not communicate ideas through standard channels.
Semantics and clear data model are compelling enough for something like this. Specially this close to beta as we are at the moment. Clear standards improve DX and encourage people to use the tools we provided in a way they were meant to be used.
Comment #7
thenchev CreditAttribution: thenchev at MD Systems GmbH for Acquia commentedSome updates. Still looking into tests. There will be test fails.
Comment #9
slashrsm CreditAttribution: slashrsm at MD Systems GmbH for Acquia commentedLet's check and do this only if the
data-entity-embed-display-settings
does not exist.Comment wrapping.
I'd also make sure non-default display settings are used (full view mode will be used by default AFAIK). Only in that case we prove that they are really respected.
Let's add full drupal-entity tag instead just one argument. For the paranoia sake...
Do we need to rely on this?
Let's check and do this only if
data-entity-embed-display-settings
doesn't exist.Doesn't work correctly. Sets 'data-entity-embed-display-settings' to boolean instead of array of configuration in case of the old attribute name. (isset()...)
Comment #10
thenchev CreditAttribution: thenchev at MD Systems GmbH for Acquia commentedAbout #4 when i remove it i get:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "embed_button" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 125 of /var/www/html/d8/core/lib/Drupal/Core/Entity/EntityTypeManager.php).
The thing is, what i think, because we need Embed to be installed when i run the tests i get errors. The database is used for the test with the standard drupal installation.
Comment #12
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedThis should fix the failing test.
Comment #13
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedTested this manually and I can confirm that backward compatibility works as expected.
I will tentatively RTBC this due to questions that were raised. Let's try to resolve any difference in views but let's try to do it in a timely manner. Specially due to the beta blocker status of this issue.
Comment #14
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedComment #15
slashrsm CreditAttribution: slashrsm at MD Systems GmbH commentedCommitted.
Comment #17
Dave ReidDue to 'data-entity-embed-settings' being removed from the CKEditor 'allowedContent' and 'requiredContent' settings, does that mean existing embeds will no longer be upcasted to widgets?