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.
The language_list function don't exist anymore on Drupal 8.
Please use \Drupal::languageManager()->getLanguages();
Thank you.
Comment | File | Size | Author |
---|---|---|---|
#9 | 2876116-9.patch | 5.98 KB | sonvir249 |
Comments
Comment #2
mgoncalves CreditAttribution: mgoncalves at CI&T commentedComment #3
hgunicamp CreditAttribution: hgunicamp at CI&T commentedAfter applying the 'taxonomy_manager-change_laguage_list_function-2876116-8x.patch' patch and using the command
find . -type f \( -name '*.inc' -or -name '*.php' \) -exec grep --color=auto -e '\blanguage_list' {} \+
I did not find more 'language_list' occurrences.
So the patch worked for me.
Comment #4
JacobSanfordThanks for the contributions, but I don't quite think we're there yet. This is a bit of a can of worms.
getLanguages() returns an array of Language Objects whereas language_list() returned an array of associative arrays keyed by strings like 'language' and 'name'.
As a result, accesses to the object and its properties within the loop are not done correctly:
Correcting this involves moving to LanguageInterface::getName and LanguageInterface::getName where appropriate (if the use of objects isn't desired). In particular, the use of
$language->language
, which AFAICT will not work at all.In accordance with #1387608: Unify language_list() and locale_language_list(), we should also try to target use of locale_language_list() in the module within this issue.
I see several uses:
Do note that as with above, a direct substitution with getLanguages() will not work. locale_language_list() returned an array of language names keyed by code.
Comment #5
Shashwat Purav CreditAttribution: Shashwat Purav commentedAssigning this issue for Drupal Mumbai Code Sprint Dec 2017.
Comment #6
sonvir249 CreditAttribution: sonvir249 as a volunteer and at QED42 commentedComment #7
sonvir249 CreditAttribution: sonvir249 as a volunteer and at QED42 commentedHi @JacobSanford,
Patch added as suggested.
Thank You!
Comment #8
navneet0693 CreditAttribution: navneet0693 as a volunteer and at QED42 commenteddebug ?
Comment #9
sonvir249 CreditAttribution: sonvir249 as a volunteer and at QED42 commentedHi @navneet0693,
debug function removed.
Thanks!
Comment #10
JacobSanfordHi Everyone,
Thanks for your help here. I appreciate the contributions.
It appears that this issue has been dated-out by the deletion of the .admin.inc file
#2849948: Missing Include
Closing.