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


PHP CRM_Core_BAO_Setting::_setItem方法代碼示例

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


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

示例1: setItems

 /**
  * Store multiple items in the setting table. Note that this will also store config keys
  * the storage is determined by the metdata and is affected by
  *  'name' setting's name
  *  'prefetch' = store in config
  *  'config_only' = don't store in settings
  *  'config_key' = the config key is different to the settings key - e.g. debug where there was a conflict
  *  'legacy_key' = rename from config or setting with this name
  *
  * _setItem() is the common logic shared by setItem() and setItems().
  *
  * @param array $params
  *   (required) An api formatted array of keys and values.
  * @param null $domains
  *
  * @throws api_Exception
  * @domains array an array of domains to get settings for. Default is the current domain
  * @return array
  */
 public static function setItems(&$params, $domains = NULL)
 {
     $originalDomain = CRM_Core_Config::domainID();
     if (empty($domains)) {
         $domains[] = $originalDomain;
     }
     $reloadConfig = FALSE;
     $fields = $config_keys = array();
     $fieldsToSet = self::validateSettingsInput($params, $fields);
     foreach ($fieldsToSet as $settingField => &$settingValue) {
         self::validateSetting($settingValue, $fields['values'][$settingField]);
     }
     foreach ($domains as $domainID) {
         if ($domainID != CRM_Core_Config::domainID()) {
             $reloadConfig = TRUE;
             CRM_Core_BAO_Domain::setDomain($domainID);
         }
         $result[$domainID] = array();
         foreach ($fieldsToSet as $name => $value) {
             if (empty($fields['values'][$name]['config_only'])) {
                 CRM_Core_BAO_Setting::_setItem($fields['values'][$name], $value, $fields['values'][$name]['group_name'], $name, CRM_Utils_Array::value('component_id', $params), CRM_Utils_Array::value('contact_id', $params), CRM_Utils_Array::value('created_id', $params), $domainID);
             }
             if (!empty($fields['values'][$name]['prefetch'])) {
                 if (!empty($fields['values'][$name]['config_key'])) {
                     $name = $fields['values'][$name]['config_key'];
                 }
                 $config_keys[$name] = $value;
             }
             $result[$domainID][$name] = $value;
         }
         if ($reloadConfig) {
             CRM_Core_Config::singleton($reloadConfig, $reloadConfig);
         }
         if (!empty($config_keys)) {
             CRM_Core_BAO_ConfigSetting::create($config_keys);
         }
         if ($reloadConfig) {
             CRM_Core_BAO_Domain::resetDomain();
         }
     }
     return $result;
 }
開發者ID:kidaa30,項目名稱:yes,代碼行數:61,代碼來源:Setting.php


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