Problem/Motivation
LanguageFormatter doesn't get all languages and doesn't check if a language is available before trying to display it.
Steps to reproduce:
1. Enable translation module
2. Go to admin/config/regional/content-language, make sure that Content is enabled and "Show language selector on create and edit pages" is checked for Article.
3. admin/structure/types/manage/article/display, make sure that language is shown
4. Create a node of that type, select language not specified or not applicable.
5. Enjoy the fatal error that you get when trying to view that node.
Proposed resolution
Check it.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#20 | interdiff.txt | 777 bytes | thenchev |
#20 | language-formatter-fatal-2461013-20.patch | 4.76 KB | thenchev |
|
Comments
Comment #1
BerdirComment #3
Gábor HojtsyThis should be able to display the locked language names too, so it should indeed get all languages. Also the classic question of whether this should display at least the language code for languages which are now deleted then comes up :)
Comment #4
Gábor HojtsyComment #5
keopxComment #6
keopxReroll
Comment #7
keopxComment #8
keopx@Berdir I see the issue needs tests, but I need more information to do this and test type.
Comment #9
keopxComment #10
keopxThe patch works fine, but in this patch I added some test changed, it does not work and needs more work.
Thanks @Berdir for your time.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedDo you mean the code change works, but the new test coverage change doesn't work as expected?
Triggering testbot.
Comment #13
BerdirYes, exactly. Turns out we didn't create the node yet, also we need to exclude that one in a few places.
I still think that the default frontpage should allow content of the current language OR not specified, otherwise that content is never shown to anyone. So I added a @todo there, I think we have an issue somewhere.
Comment #15
scottalan CreditAttribution: scottalan at Phase2 commentedRemoving "Needs Test" tag. Already has a test.
Comment #16
keopxLooks good, test works.
Comment #17
xjmLet's find that issue somewhere, or failing that, file it. :)
Is the bug Views-specific? I didn't get that from the summary. If not it's strange to add the only test coverage there.
Also steps to reproduce/test would be helpful for reviewing. :)
Comment #18
Berdir1. I knew it would be a bad idea to sneak that in :p... I'll create an issue, talked about it with @Gabor before...
2. No, it's not specific to views, but I'm not aware of anything that uses a formatter for displaying a language other than views. Field formatters are the new views field plugins ;)
Comment #19
Gábor Hojtsy@Berdir: well, entities have language hidden in their display formats, that can be turned on too?
Comment #20
thenchev CreditAttribution: thenchev at MD Systems GmbH commentedComment #21
thenchev CreditAttribution: thenchev at MD Systems GmbH commentedComment #22
Berdir1. Yes, just removing the todo and documenting it as it being so is fine, it's not related to this issue.
Steps to reproduce added to the issue summary. We could also write a test that does that instead and not do it using views, but on the other site, that's what the issue that added the language formatter did as well: #2384863: Translation language base field handler should use views field handler, provide unified options.
Gabor, thoughts?
Comment #23
BerdirThis is also blocking redirect.module, we want to convert the admin overview to a view and it fatals with that because non-language specific redirects are common and the default for redirect: https://github.com/md-systems/redirect/pull/28
Comment #24
Gábor HojtsyYeah #2384863: Translation language base field handler should use views field handler, provide unified options added views coverage because it was about reproducing prior views functionality. Now with the cleaned up test comments, let's see if committers are fine just basing off of that test. It certainly tests the same thing either way.
Comment #25
alexpott@Gábor Hojtsy yep I'm happy.
This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 67692cb and pushed to 8.0.x. Thanks!
Comment #27
Gábor HojtsyAmazing, thanks!