$entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']);
$request = $apiRequest['params'];
- _civicrm_api3_generic_getList_defaults($entity, $request);
+ // Hey api, would you like to provide default values?
+ $fnName = "_civicrm_api3_{$entity}_getlist_defaults";
+ $defaults = function_exists($fnName) ? $fnName($request) : array();
+ _civicrm_api3_generic_getList_defaults($entity, $request, $defaults);
// Hey api, would you like to format the search params?
$fnName = "_civicrm_api3_{$entity}_getlist_params";
*
* @param string $entity
* @param array $request
+ * @param array $apiDefaults
*/
-function _civicrm_api3_generic_getList_defaults($entity, &$request) {
+function _civicrm_api3_generic_getList_defaults($entity, &$request, $apiDefaults) {
$config = CRM_Core_Config::singleton();
$fields = _civicrm_api_get_fields($entity);
$defaults = array(
}
}
$resultsPerPage = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10);
- $request += $defaults;
+ $request += $apiDefaults + $defaults;
// Default api params
$params = array(
'options' => array(
function civicrm_api3_relationship_type_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+
+/**
+ * @see _civicrm_api3_generic_getlist_defaults
+ *
+ * @param array $request
+ * @return array
+ */
+function _civicrm_api3_relationship_type_getlist_defaults($request) {
+ return array(
+ 'label_field' => 'label_a_b',
+ 'search_field' => 'label_a_b',
+ );
+}
\ No newline at end of file