You are here

function services_entity_services_resources_alter in Services Entity API 7.2

Implements hook_services_resources_alter().

File

./services_entity.module, line 89

Code

function services_entity_services_resources_alter(&$resources) {

  // For entities that the services module already implements, borrow any operations, actions and relationships.
  foreach ($resources as $name => $resource) {
    if (preg_match('/^entity_/', $name)) {
      $orig_name = preg_replace('/^entity_/', '', $name);
      if (isset($resources[$orig_name])) {
        foreach ($resources[$orig_name] as $type => $info) {
          foreach ($info as $id => $op) {
            if (!isset($resources[$name][$type][$id])) {
              $resources[$name][$type][$id] = $op;
            }
          }
        }
      }
    }
  }
}