/** * Get current language * * @return string Language code */ protected function getCurrentLanguage() { // DO NOT change call order here if (!\XLite::isAdminZone() && function_exists('drupal_multilingual') && drupal_multilingual()) { global $language; if ($language instanceof \stdClass) { $object = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findOneByCode($language->language); // DO NOT use "===" here if (isset($object) && \XLite\Model\Language::ENABLED == $object->getStatus()) { $result = $object->getCode(); } } } return isset($result) ? $result : parent::getCurrentLanguage(); }