Problem/Motivation
As a followup from adding multilingual support:
#2414913: Support entity translation of paragraphs
The node form is now simultaneously editing multiple entities due to the composite relationship of the paragraphs.
Multilingual paragraphs (in how we support them) means that all paragraphs present in language A are also present in language B.
While translating, buttons to add / remove paragraphs are still present. The core behaviour about what field is "all languages" and what is language specific does not work anymore. The paragraph field on its own is "all languages" while the referenced entities (can) contain translatable fields. Then below, the buttons to add new paragraphs are again all languages.
Proposed resolution
Reduce user confusion and hide "remove" and "add" actions when translating.
(Indeed, also changing sequence is a thing that also affects all languages..)
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#22 | paragraphs_2463491_hide_22.patch | 5.83 KB | jeroen.b |
#20 | paragraphs_2463491_hide_20_combined.patch | 14.25 KB | miro_dietiker |
#20 | paragraphs_2463491_hide_20-do-not-test.patch | 5.83 KB | miro_dietiker |
#20 | paragraphs_2463491_hide_20.interdiff.txt | 1.58 KB | miro_dietiker |
#18 | paragraphs_2463491_hide_18_comined.patch | 13.78 KB | miro_dietiker |
Comments
Comment #1
miro_dietikerComment #2
miro_dietikerFrom the original issue / Berdir suggestion:
Check $paragraph_item->language()->getId() != $paragraph_item->getUntranslated()->language()->getId()
Comment #3
miro_dietikerTBD: Force this behaviour or add a setting to disable it?
Comment #4
jeroen.b CreditAttribution: jeroen.b commentedI think it would be best to force this behaviour.
Suggestion looks OK to me.
Comment #5
miro_dietikerPromoting this as a major usability issue in multilingual paragraphs.
Comment #6
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedComment #8
miro_dietikerFor me this is just too much on one single line.
Shouldn't we introduce a helper method isTranslation($entity) or isSource($entity) somewhere?
And we need tests pass and extended and checking the newly defined UI pattern including checks that assure the elements are removed.
Comment #9
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedThe if check should be the other way around, i guess.
Tests are coming tomorrow morning, probably in a separate issue?
Comment #10
miro_dietikerNo, tests always part of the issue. At least basic test coverage. :-)
Comment #11
miro_dietikerWhen editing a translation, add / remove is dropped.
However, when adding a translation, they are still present.
And i just identified lots of issues with the translation workflow and need to update #2414913: Support entity translation of paragraphs
Comment link: https://www.drupal.org/node/2414913#comment-9834765
Comment #12
miro_dietikerOhh, forgot to mention...
Possibly you should just set #access to FALSE to hide the button, instead of changing the whole nesting.
Comment #13
sasanikolic CreditAttribution: sasanikolic at MD Systems GmbH commentedChanged the check for the add button as suggested.
Still need to fix the hide buttons while adding a translation issue.
Comment #14
miro_dietikerFirst providing a patch that only adds #access without all the other complexity. Only 5 changing lines.
Comment #15
miro_dietikerAbout the missing part: The language should already be set when creating a translation. But it is not. So that's a bug on #2414913: Support entity translation of paragraphs
Comment #16
miro_dietikerNice. So the other patch passes and hiding buttons is now easier.
The patch to test also includes the paragraphs issue dependency.
Comment #17
miro_dietikerStill missing tests that check if the button are properly removed.
Comment #18
miro_dietikerWrote the tests to make sure the buttons are there / gone as defined.
Comment #19
BerdirA comment here would be useful I think, to explain why we want to enforce it like this.
Same comment here..
Comment #20
miro_dietikerAdded nice comment.
Comment #21
BerdirVery niiice comment ;)
Reminder: The do-not-test patch is the one that will need to be committed, after #2414913: Support entity translation of paragraphs is committed.
Comment #22
jeroen.b CreditAttribution: jeroen.b at .VDMi/ commentedResubmitted for retest
Comment #23
jeroen.b CreditAttribution: jeroen.b at .VDMi/ commentedComment #24
jeroen.b CreditAttribution: jeroen.b at .VDMi/ commentedPasses the tests so pushed to dev, thanks!