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 translating, depending on the settings we might get all the Paragraphs open, even the ones that do not have translatable fields. This clutters the UI with fields that are not supposed to be translated.
Proposed resolution
Close paragraphs that do not have translatable fields while translating.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#15 | paragraphs_3008364_11.patch | 10.62 KB | miro_dietiker |
| |||
#15 | paragraphs_3008364_11.interdiff.txt | 1.29 KB | miro_dietiker |
#14 | interdiff-3008687-12-14.txt | 889 bytes | johnchque |
#14 | close_paragraphs_translating-3008687-14.patch | 10.67 KB | johnchque |
| |||
#12 | interdiff-3008687-10-12.txt | 2.98 KB | johnchque |
Comments
Comment #2
johnchqueThis should work. :)
Comment #4
miro_dietikerReally only do this loop and all this complexity if we are translating and it is until now considered open.
If we have such a force-closed Paragraph, we should maybe also hide the edit button as there's nothing you can do anyway.
If i'm wrong, we can always revert this direction...
Maybe we should look at this combined with the other requirement to always expand Paragraphs when adding a translation.
#2954921: Expand all Paragraphs recursively when adding a translation
There will be more to consider as unpublished paragraph translations could indicate that a translation is not yet ready, so expansion still makes sense on later edits. However it would be not if the semantic of an unpublished paragraph translation means it should persistently be hidden for that language. That's why we need to define how to deal with this.
Realizing that combining is boosting complexity and slowing us down and we maybe should go step by step.
So let's stay limited here, but include the hiding of the edit button.
Then we can do a UX assessment on real content instances to figure out if it creates frictions.
Comment #5
miro_dietikerComment #6
miro_dietikerThere's one thing we shouldn't forget:
If you don't have content moderation enabled, you can easily have untranslatable fields displayed when translating.
If someone prefers this flavor of editing everyting that is visible on the translation rendering on one page, we can not force close and hide.
Not sure where core goes, but we should only force collapse if fields are configured to be hidden.
So we need to check the setting at admin/config/regional/content-language for the content type in question: "Hide non translatable fields on translation forms"
Comment #7
johnchqueThanks for the feedback. About only doing this when open, I think that we need to check in every widget state not that we are hiding the buttons, because we can have an already closed paragraph, that has no translatable fields and that has that content moderation setting enabled, then we would be able to open it and then get nothing.
Adding more tests. :)
Comment #9
miro_dietikerThat's a super strange name and IMHO the logic is inverted.
We want a variable $translating_force_close = FALSE -- maiby just $force_close -- initially that is set to TRUE if expanding is not allowed anymore.
Then below its && !$force_close;
It's simply weird otherwise if we have a variable "translating_open" that is set to TRUE if we are not translating at all...
Soo i see we have a bunch of fails? ;-)
Comment #10
johnchqueRight! Changed the name of the variable, tests are passing locally. Let's see what is happening here. :)
Comment #12
johnchqueOops, this should fix the tests fails.
Comment #14
johnchquehmm my bad here.
Comment #15
miro_dietikerLooks awesome. Some nitpick below..
We can quit the loop with break on the first match here.
Rewriting a bit blindly.
Comment #17
miro_dietikerAwesome, committing this. :-)
Comment #18
BerdirThis is nice, but it might not be 100% obvious to users *why* they can't do anything with those paragraphs. Maybe we could use the free space to show some sort of notice that this paragraph can not be expanded because there's nothing to translate?
Comment #19
miro_dietikerCreated follow-up #3009913: Indicate why a Paragraph without translatable fields is force collapsed