X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FCustomField.php;h=9fbc50ed7f2defc89b5f5cc1861d7521bedf63f1;hb=b319421df58cfbeb99ca3016a8315b56690458ba;hp=10d7fedead2057cb0a21a19f5cdba5a6d87e06dd;hpb=4d32d50b462d76a14faf7a6f732816ee9fe40ee6;p=civicrm-core.git diff --git a/api/v3/CustomField.php b/api/v3/CustomField.php index 10d7fedead..9fbc50ed7f 100644 --- a/api/v3/CustomField.php +++ b/api/v3/CustomField.php @@ -2,9 +2,9 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | + | CiviCRM version 4.5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | + | Copyright CiviCRM LLC (c) 2004-2014 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -32,7 +32,7 @@ * @package CiviCRM_APIv3 * @subpackage API_CustomField * - * @copyright CiviCRM LLC (c) 2004-2013 + * @copyright CiviCRM LLC (c) 2004-2014 * @version $Id: CustomField.php 30879 2010-11-22 15:45:55Z shot $ */ @@ -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 *