X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FCustomField.php;h=6a41b74be23d1db2208a886d6d95a12fec7a5b21;hb=3f85d92dc57cc30cc70ce4a35178c26e01031551;hp=10d7fedead2057cb0a21a19f5cdba5a6d87e06dd;hpb=f0985b2635377b0e02d204d5adf872fce4997758;p=civicrm-core.git diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index 10d7fedead..6a41b74be2 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -2,7 +2,7 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | + | CiviCRM version 4.4 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2013 | +--------------------------------------------------------------------+ @@ -74,12 +74,20 @@ function civicrm_api3_custom_field_create($params) { $params['option_weight'][$key] = $value['weight']; } } + $values = array(); $customField = CRM_Core_BAO_CustomField::create($params); - civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1)); _civicrm_api3_object_to_array_unique_fields($customField, $values[$customField->id]); + _civicrm_api3_custom_field_flush_static_caches(); return civicrm_api3_create_success($values, $params, 'custom_field', $customField); } +/** + * Flush static caches in functions that might have stored available custom fields + */ +function _civicrm_api3_custom_field_flush_static_caches(){ + civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1)); + CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE); +} /** * Adjust Metadata for Create action *