當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Utils_Hook::alterSettingsFolders方法代碼示例

本文整理匯總了PHP中CRM_Utils_Hook::alterSettingsFolders方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Utils_Hook::alterSettingsFolders方法的具體用法?PHP CRM_Utils_Hook::alterSettingsFolders怎麽用?PHP CRM_Utils_Hook::alterSettingsFolders使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Utils_Hook的用法示例。


在下文中一共展示了CRM_Utils_Hook::alterSettingsFolders方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getMetadata

 /**
  * WARNING: This interface may change.
  *
  * This provides information about the setting - similar to the fields concept for DAO information.
  * As the setting is serialized code creating validation setting input needs to know the data type
  * This also helps move information out of the form layer into the data layer where people can interact with
  * it via the API or other mechanisms. In order to keep this consistent it is important the form layer
  * also leverages it.
  *
  * Note that this function should never be called when using the runtime getvalue function. Caching works
  * around the expectation it will be called during setting administration
  *
  * Function is intended for configuration rather than runtime access to settings
  *
  * The following params will filter the result. If none are passed all settings will be returns
  *
  * @param array $filters
  * @param int $domainID
  *
  * @return array
  *   the following information as appropriate for each setting
  *   - name
  *   - type
  *   - default
  *   - add (CiviCRM version added)
  *   - is_domain
  *   - is_contact
  *   - description
  *   - help_text
  */
 public static function getMetadata($filters = array(), $domainID = NULL)
 {
     if ($domainID === NULL) {
         $domainID = \CRM_Core_Config::domainID();
     }
     $cache = \Civi::cache('settings');
     $cacheString = 'settingsMetadata_' . $domainID . '_';
     // the caching into 'All' seems to be a duplicate of caching to
     // settingsMetadata__ - I think the reason was to cache all settings as defined & then those altered by a hook
     $settingsMetadata = $cache->get($cacheString);
     $cached = is_array($settingsMetadata);
     if (!$cached) {
         $settingsMetadata = $cache->get(self::ALL);
         if (empty($settingsMetadata)) {
             global $civicrm_root;
             $metaDataFolders = array($civicrm_root . '/settings');
             \CRM_Utils_Hook::alterSettingsFolders($metaDataFolders);
             $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders);
             $cache->set(self::ALL, $settingsMetadata);
         }
     }
     \CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, NULL);
     if (!$cached) {
         $cache->set($cacheString, $settingsMetadata);
     }
     self::_filterSettingsSpecification($filters, $settingsMetadata);
     return $settingsMetadata;
 }
開發者ID:rameshrr99,項目名稱:civicrm-core,代碼行數:58,代碼來源:SettingsMetadata.php

示例2: getSettingSpecification

 /**
  * This provides information about the setting - similar to the fields concept for DAO information.
  * As the setting is serialized code creating validation setting input needs to know the data type
  * This also helps move information out of the form layer into the data layer where people can interact with
  * it via the API or other mechanisms. In order to keep this consistent it is important the form layer
  * also leverages it.
  *
  * Note that this function should never be called when using the runtime getvalue function. Caching works
  * around the expectation it will be called during setting administration
  *
  * Function is intended for configuration rather than runtime access to settings
  *
  * The following params will filter the result. If none are passed all settings will be returns
  *
  * @param int $componentID
  *   Id of relevant component.
  * @param array $filters
  * @param int $domainID
  * @param null $profile
  *
  * @return array
  *   the following information as appropriate for each setting
  *   - name
  *   - type
  *   - default
  *   - add (CiviCRM version added)
  *   - is_domain
  *   - is_contact
  *   - description
  *   - help_text
  */
 public static function getSettingSpecification($componentID = NULL, $filters = array(), $domainID = NULL, $profile = NULL)
 {
     $cacheString = 'settingsMetadata_' . $domainID . '_' . $profile;
     foreach ($filters as $filterField => $filterString) {
         $cacheString .= "_{$filterField}_{$filterString}";
     }
     $cached = 1;
     // the caching into 'All' seems to be a duplicate of caching to
     // settingsMetadata__ - I think the reason was to cache all settings as defined & then those altered by a hook
     $settingsMetadata = CRM_Core_BAO_Cache::getItem('CiviCRM setting Specs', $cacheString, $componentID);
     if ($settingsMetadata === NULL) {
         $settingsMetadata = CRM_Core_BAO_Cache::getItem('CiviCRM setting Spec', 'All', $componentID);
         if (empty($settingsMetadata)) {
             global $civicrm_root;
             $metaDataFolders = array($civicrm_root . '/settings');
             CRM_Utils_Hook::alterSettingsFolders($metaDataFolders);
             $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders);
             CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Spec', 'All', $componentID);
         }
         $cached = 0;
     }
     CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, $profile);
     self::_filterSettingsSpecification($filters, $settingsMetadata);
     if (!$cached) {
         // this is a bit 'heavy' if you are using hooks but this function
         // is expected to only be called during setting administration
         // it should not be called by 'getvalue' or 'getitem
         CRM_Core_BAO_Cache::setItem($settingsMetadata, 'CiviCRM setting Specs', $cacheString, $componentID);
     }
     return $settingsMetadata;
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:62,代碼來源:Setting.php


注:本文中的CRM_Utils_Hook::alterSettingsFolders方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。