You are here

function uc_store_mail_recipient_langcode in Ubercart 8.4

Gets the preferred language code for a user's email address.

Parameters

string $address: The email address to check.

Return value

string The language code to be used in translation, localization, etc. If a user account can not be found for $address, the default language code is returned.

See also

LanguageManagerInterface::getDefaultLanguage()

14 calls to uc_store_mail_recipient_langcode()
CartManager::completeSaleAccount in uc_cart/src/CartManager.php
Link a completed sale to a user.
EmailOrderInvoice::doExecute in uc_order/src/Plugin/RulesAction/EmailOrderInvoice.php
Emails an invoice.
hook_uc_stock_adjusted in uc_stock/uc_stock.api.php
Allows modules to take action when a stock level is changed.
MailInvoiceForm::submitForm in uc_order/src/Form/MailInvoiceForm.php
Form submission handler.
OrderAdminController::selectCustomer in uc_order/src/Controller/OrderAdminController.php
Presents the customer search results and let one of them be chosen.

... See full list

File

uc_store/uc_store.module, line 751
Contains global Ubercart functions and store administration functionality.

Code

function uc_store_mail_recipient_langcode($address) {
  $account = user_load_by_mail(trim($address));
  return $account ? $account
    ->getPreferredLangcode() : \Drupal::languageManager()
    ->getDefaultLanguage()
    ->getId();
}