API page: https://api.drupal.org/api/drupal/core%21modules%21user%21src%21Entity%2...
> If the preferred language is not set or is a language not configured anymore on the site, the site default is returned or an empty string is returned (if $fallback_to_default is FALSE).
This is phased as "If A or B, then C or D, if E".
So, what happens if A? What happens if B? You can't really tell...
Logically, if there no no language configured on the site, then there's no site default to return, so you'd get an empty string. But it takes a fair amount of picking that sentence apart to see that.
This should be rewritten in several sentences, and ideally with bullet points to explain what happens.
Comment | File | Size | Author |
---|---|---|---|
#2 | fix-return-doc-getPreferredLangcode-2972300-2.patch | 1.12 KB | msankhala |
Comments
Comment #2
msankhala CreditAttribution: msankhala as a volunteer and at Srijan | A Material+ Company commentedThis patch fixes the doc with @return.
Comment #3
surbz CreditAttribution: surbz at Srijan | A Material+ Company commented@msankhala Thanks for putting this up.
I can confirm that the patch applies cleanly and gives a better understanding.
Comment #4
surbz CreditAttribution: surbz at Srijan | A Material+ Company commentedComment #5
alexpottcrediting @joachim for filing this issue.
Committed and pushed bc8ba878e5 to 8.7.x and 9f4ca29c06 to 8.6.x. Thanks!