RESTful-Drupal / restful

RESTful best practices for Drupal
https://drupal.org/project/restful
418 stars 173 forks source link

Multiple calls hook_restful_resource_alter #1028

Open abratko opened 6 years ago

abratko commented 6 years ago

All hooks hook_restful_resource_alter are called all time when resource getting from resource collection.

/restful/src/Resource/ResourcePluginCollection.php

public function &get($instance_id) {
      $resource = parent::get($instance_id);
      // Allow altering the resource, this way we can read the resource's
      // definition to return a different class that is using composition.
      drupal_alter('restful_resource', $resource);
      $resource = $resource->isEnabled() ? $resource : NULL;
}