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
When the style plugins provide their templates, they are not always used since they don't seem to be added at the end of the suggestions array.
Proposed resolution
Ensure that the template suggestions are added at the end.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff-2965637-8-10.txt | 1.61 KB | johnchque |
#10 | ensure_style_templates-2965637-10.patch | 5.18 KB | johnchque |
| |||
#8 | interdiff-2965637-3-8.txt | 2.24 KB | johnchque |
#8 | ensure_style_templates-2965637-8.patch | 4.86 KB | johnchque |
| |||
#3 | interdiff-2965637-2-3.txt | 985 bytes | johnchque |
Comments
Comment #2
johnchqueThis should work, adding tests. Need to update tests, doing that.
Comment #3
johnchqueSo this should be a better test, forgot about it. Not sure why it is not taken the paragraph type template.
Comment #6
johnchqueNot really sure why it fails, it seems that the quote Paragraph type has its own template to be overriden. My changes did not do anything related with the quote type.
Comment #7
Berdiras discussed, you drop the existing suggestions here. you also don't need to return them anymore (as they are altered by reference), but you do want to keep the early return.
replacing the template *only* with your change could be confusing when debugging. I would suggest you instead extend from the default paragraph.html.twig and just *add* a static line, to assert that it is there.
Comment #8
johnchqueYeah, sorry my bad, didn't realize that I have removed that. :)
Comment #9
BerdirHm. You're not *really* sure that the right paragraph is using the right template with this.
I would do it with a single paragraph that you change. First create it without a style value, save. Make sure it shows the type template.
Then edit, select a style and save again, make sure it uses the other template now.
Comment #10
johnchqueRight, now should be better. :)
Comment #12
BerdirThanks, looks good.