X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FResources.php;h=6945376e6120e76d07d63190ef7cbc3ca1b86ee1;hb=26ad621a0eb1aa1757755684d45cb162f6284985;hp=0175befd74fad5b26da670ce793fb5c33058c846;hpb=499b3e43689b0326f017f799c7fc092e1d2b4a43;p=civicrm-core.git diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 0175befd74..6945376e61 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -336,7 +336,9 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface * @return string */ public function getCacheCode() { - return $this->cacheCode; + // Ex: AngularJS json partials are language-specific because they ship with the strings + // for the current language. + return $this->cacheCode . CRM_Core_I18n::getLocale(); } /** @@ -494,27 +496,16 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface * * @return array */ - public static function getEntityRefMetadata() { + protected static function getEntityRefMetadata() { $data = [ 'filters' => [], 'links' => [], ]; - $config = CRM_Core_Config::singleton(); - - $disabledComponents = []; - $dao = CRM_Core_DAO::executeQuery("SELECT name, namespace FROM civicrm_component"); - while ($dao->fetch()) { - if (!in_array($dao->name, $config->enableComponents)) { - $disabledComponents[$dao->name] = $dao->namespace; - } - } foreach (CRM_Core_DAO_AllCoreTables::daoToClass() as $entity => $daoName) { // Skip DAOs of disabled components - foreach ($disabledComponents as $nameSpace) { - if (strpos($daoName, $nameSpace) === 0) { - continue 2; - } + if (defined("$daoName::COMPONENT") && !CRM_Core_Component::isEnabled($daoName::COMPONENT)) { + continue; } $baoName = str_replace('_DAO_', '_BAO_', $daoName); if (class_exists($baoName)) { @@ -563,7 +554,7 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface $hasQuery = strpos($url, '?') !== FALSE; $operator = $hasQuery ? '&' : '?'; - return $url . $operator . 'r=' . $this->cacheCode; + return $url . $operator . 'r=' . $this->getCacheCode(); } /** @@ -578,7 +569,7 @@ class CRM_Core_Resources implements CRM_Core_Resources_CollectionAdderInterface } /** - * @param string|NULL $region + * @param string|null $region * Optional request for a specific region. If NULL/omitted, use global default. * @return \CRM_Core_Region */