You are here

protected function ServicesEntityResourceControllerClean::get_resource_reference in Services Entity API 7.2

Return a resource reference array.

Parameters

type $resource:

type $id:

Return value

type

1 call to ServicesEntityResourceControllerClean::get_resource_reference()
ServicesEntityResourceControllerClean::get_data in plugins/services_entity_resource_clean.inc
Return the data structure for an entity stripped of all "drupalisms" such as field_ and complex data arrays.

File

plugins/services_entity_resource_clean.inc, line 197

Class

ServicesEntityResourceControllerClean
This class is designed to create a very clean API that integrates with the services and entity modules. We want to strip all "drupalisms" out of the API. For example, there should be no [LANGUAGE_NONE][0][value] or field_ in the API.

Code

protected function get_resource_reference($resource, $id) {
  $return = array(
    'uri' => services_resource_uri(array(
      'entity_' . $resource,
      $id,
    )),
    'id' => $id,
    'resource' => $resource,
  );
  if (module_exists('uuid') && entity_get_info($resource)) {
    $ids = entity_get_uuid_by_id($resource, array(
      $id,
    ));
    if ($id = reset($ids)) {
      $return['uuid'] = $id;
    }
  }
  return $return;
}