Skip to content
Snippets Groups Projects
Commit c59c5519 authored by Monish Deb's avatar Monish Deb
Browse files

additional fixes

parent 8da6670d
Branches
Tags
No related merge requests found
......@@ -509,7 +509,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
$config = CRM_Core_Config::singleton();
}
if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != 'en_US') {
if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != CRM_Core_I18n::getLocale()) {
$swapLang = CRM_Utils_AutoClean::swap('global://dbLocale?getter', 'call://i18n/setLocale', $mailing->language);
}
......
......@@ -709,6 +709,11 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
return $url;
}
// Drupal might not be bootstrapped if being called by the REST API.
if (!class_exists('Drupal')) {
return NULL;
}
$language = $this->getCurrentLanguage();
if (\Drupal::service('module_handler')->moduleExists('language')) {
$config = \Drupal::config('language.negotiation')->get('url');
......@@ -722,7 +727,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
//url prefix
if ($urlType == \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::CONFIG_PATH_PREFIX) {
if (!empty($language)) {
if ($addLanguagePart) {
if ($addLanguagePart && !empty($config['prefixes'][$language])) {
$url .= $config['prefixes'][$language] . '/';
}
if ($removeLanguagePart) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment