You are here

class ResourcePluginCollection in RESTful 7.2

Hierarchy

Expanded class hierarchy of ResourcePluginCollection

File

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

Namespace

Drupal\restful\Resource
View source
class ResourcePluginCollection extends DefaultLazyPluginCollection {

  /**
   * The key within the plugin configuration that contains the plugin ID.
   *
   * @var string
   */
  protected $pluginKey = 'name';

  /**
   * Overwrites LazyPluginCollection::get().
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultLazyPluginCollection::$configurations protected property The initial configuration for each plugin in the collection.
DefaultLazyPluginCollection::$manager protected property The manager used to instantiate the plugins.
DefaultLazyPluginCollection::$originalOrder protected property The original order of the instances.
DefaultLazyPluginCollection::addInstanceId public function Adds an instance ID to the available instance IDs. Overrides LazyPluginCollection::addInstanceId
DefaultLazyPluginCollection::getConfiguration public function Gets the current configuration of all plugins in this collection. Overrides LazyPluginCollection::getConfiguration
DefaultLazyPluginCollection::initializePlugin protected function Initializes and stores a plugin. Overrides LazyPluginCollection::initializePlugin
DefaultLazyPluginCollection::removeInstanceId public function Removes an instance ID. Overrides LazyPluginCollection::removeInstanceId
DefaultLazyPluginCollection::setConfiguration public function Sets the configuration for all plugins in this collection. Overrides LazyPluginCollection::setConfiguration
DefaultLazyPluginCollection::setInstanceConfiguration public function Updates the configuration for a plugin instance.
DefaultLazyPluginCollection::sort public function Sorts all plugin instances in this collection.
DefaultLazyPluginCollection::sortHelper public function Provides uasort() callback to sort plugins.
DefaultLazyPluginCollection::__construct public function Constructs a new DefaultLazyPluginCollection object.
LazyPluginCollection::$instanceIDs protected property Stores the IDs of all potential plugin instances.
LazyPluginCollection::$pluginInstances protected property Stores all instantiated plugins.
LazyPluginCollection::clear public function Clears all instantiated plugins.
LazyPluginCollection::count public function
LazyPluginCollection::getInstanceIds public function Gets all instance IDs.
LazyPluginCollection::getIterator public function
LazyPluginCollection::has public function Determines if a plugin instance exists.
LazyPluginCollection::remove public function Removes an initialized plugin.
LazyPluginCollection::set public function Stores an initialized plugin.
ResourcePluginCollection::$pluginKey protected property The key within the plugin configuration that contains the plugin ID. Overrides DefaultLazyPluginCollection::$pluginKey
ResourcePluginCollection::get public function Overwrites LazyPluginCollection::get(). Overrides LazyPluginCollection::get