By gábor hojtsy on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
The API function user_preferred_language() was changed to $user->getPreferredLangcode() and returns only the langcode, which then can be used to load the language if needed.
Given that most uses of the user preferred language reference other data keyed by language code, we found that loading the language is not too often in the requirements, so this makes it easier to retrieve the value.
The type argument has been removed and replaced with a separte method: and $user->getPreferredAdminLangcode()
Drupal 7:
drupal_mail('contact', 'user_mail', $to, user_preferred_language($values['recipient']), $values, $from);
Drupal 8:
drupal_mail('contact', 'user_mail', $to, $values['recipient']->getPreferredLangcode(), $values, $from);
Related to drupal_mail() and hook_mail() changes: http://drupal.org/node/1783398
Impacts:
Module developers