/*
+--------------------------------------------------------------------+
- | 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. |
| |
* @package CiviCRM_APIv3
* @subpackage API_EntityTag
*
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: EntityTag.php 30879 2010-11-22 15:45:55Z shot $
*/
*/
function civicrm_api3_entity_tag_get($params) {
-
- $values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']);
- $result = array();
- foreach ($values as $v) {
- $result[$v] = array('tag_id' => $v);
+ if(empty($params['entity_id'])) {
+ return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+ }
+ else{
+ //do legacy non-standard behaviour
+ $values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']);
+ $result = array();
+ foreach ($values as $v) {
+ $result[$v] = array('tag_id' => $v);
+ }
+ return civicrm_api3_create_success($result, $params);
}
- return civicrm_api3_create_success($result, $params);
}
/**
* @param array $params array or parameters determined by getfields
*/
function _civicrm_api3_entity_tag_get_spec(&$params) {
- $params['entity_id']['api.required'] = 1;
$params['entity_id']['api.aliases'] = array('contact_id');
$params['entity_table']['api.default'] = 'civicrm_contact';
}