public function EntityDerivative::getDerivativeDefinitions

Implements DerivativeInterface::getDerivativeDefinitions().

Overrides DerivativeInterface::getDerivativeDefinitions

1 call to EntityDerivative::getDerivativeDefinitions()
EntityDerivative::getDerivativeDefinition in drupal/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php
Implements DerivativeInterface::getDerivativeDefinition().

File

drupal/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php, line 39
Definition of Drupal\rest\Plugin\Derivative\EntityDerivative.

Class

EntityDerivative
Provides a resource plugin definition for every entity type.

Namespace

Drupal\rest\Plugin\Derivative

Code

public function getDerivativeDefinitions(array $base_plugin_definition) {
  if (!isset($this->derivatives)) {

    // Add in the default plugin configuration and the resource type.
    foreach (entity_get_info() as $entity_type => $entity_info) {
      $this->derivatives[$entity_type] = array(
        'id' => 'entity:' . $entity_type,
        'entity_type' => $entity_type,
        'label' => $entity_info['label'],
      );
      $this->derivatives[$entity_type] += $base_plugin_definition;
    }
  }
  return $this->derivatives;
}