You are here

public function ResourcePluginCollection::get in RESTful 7.2

Overwrites LazyPluginCollection::get().

Overrides LazyPluginCollection::get

File

src/Resource/ResourcePluginCollection.php, line 24
Contains \Drupal\restful\Resource\ResourcePluginCollection

Class

ResourcePluginCollection

Namespace

Drupal\restful\Resource

Code

public function &get($instance_id) {

  /* @var \Drupal\restful\Plugin\resource\ResourceInterface $resource */
  $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;
  return $resource;
}