You are here

function civicrm_entity_metadata_civicrm_entity_get_properties in CiviCRM Entity 7.2

Same name and namespace in other branches
  1. 7 civicrm_entity.module \civicrm_entity_metadata_civicrm_entity_get_properties()

Implement getter callback.

NB this is in a separate file called callbacks.inc in entity module

  • I couldn't see how it was loaded so maybe the name has some

magic?

MH - Skvare -- This function should not use the CiviCRM api, but instead the Drupal Entity API to load and return the entity object

Parameters

$data:

$options:

$name:

$type:

$info:

Return value

object

1 string reference to 'civicrm_entity_metadata_civicrm_entity_get_properties'
_civicrm_entity_getproperties in ./civicrm_entity.module
Calculate fields for entities

File

./civicrm_entity.module, line 2833

Code

function civicrm_entity_metadata_civicrm_entity_get_properties($data, $options, $name, $type, $info) {
  if (isset($info['property_info']['entity']) && isset($data->{$info['property_info']['field']})) {

    /* $entity = civicrm_api($info['property_info']['entity'], 'get', array(
         'version' => 3,
         'id' => $data->$info['property_info']['field'],
         'sequential' => 1,
       ));
       return (object) $entity['values'][0];*/
    return entity_load_single('civicrm_' . $info['property_info']['entity'], $data->{$info['property_info']['field']});
  }
}