Problem/Motivation
When adding a link via form_alter hook the translatability clue ('all_languages' markup) is added to the links title (see picture).
Proposed resolution
Append the type 'link' to the $ignored_types array of ContentTranslationHandler::entityFormSharedElements, as links don't require the translatability clue.
Remaining tasks
Write tests
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#15 | 2674068-15.patch | 8.79 KB | tstoeckler |
#15 | 2674068-15--tests-with-link.patch | 7.94 KB | tstoeckler |
all_languages_html_in_link_title.png | 11.72 KB | juliaschwarz |
Comments
Comment #2
juliaschwarz CreditAttribution: juliaschwarz commentedPatch with changes as described within the proposed resolution.
Comment #3
juliaschwarz CreditAttribution: juliaschwarz commentedCorrected 'great' mistake (link instead of links).
Comment #5
hchonovSeems legit, as the translatability clue should be ignored for links as well. It does not represent a disruptive change and therefore I think it could be target against 8.1.x.
Comment #6
hchonovComment #7
alexpottWe should have test coverage of this.
Comment #8
balagan CreditAttribution: balagan commentedComment #11
hchonovRe-roll because of #2776975: March 3, 2017: Convert core to array syntax coding standards for Drupal 8.3.x RC phase.
Comment #12
hchonovComment #15
tstoecklerWent ahead and wrote a test for this. I thought writing a full functional test, which would have been nicer, because this is about output that is shown to users, but in my opinion it would have been very complicated to conjure up an entity form which contains arbitrary form elements, so I went with a kernel test. Because the cyclomatic complexity of the method being tested is quite high there are quite a number of test cases to cover here, but that only strengthens the case for using a kernel test as we can nicely use a data provider to cover all possible cases. Covering all possible cases with a UI test would have been very very difficult if at all possible.
So the first patch just contains a test that passes in HEAD, the second patch then adds a test for ignoring link elements to the test which then should fail on that one test case and is also the interdiff to #11 and then the third patch actually includes the fix and should again pass. #11 actually didn't apply anymore, so I "rerolled" the fix itself.
Comment #17
borisson_I like that you make this a kernel test, because a btb-test would make it not just harder to test all the variations, it would also be a lot slower.
I didn't find anything that I'd like to see changed in this patch, but I don't feel confident enough to set it to RTBC.
Comment #19
geaseSomeone needs to set to RTBC. Fix itself is in line with the approach to ignore non-widget form elements. Test, to me, covers all use-cases for translated and untranslated fields.
Comment #20
alexpottCommitted and pushed b760da1161 to 9.0.x and 3a1f07e0bc to 8.9.x. Thanks!
Comment #23
alexpottDiscussed with @catch and we agreed to backport.