You are here

public function EntityDeriver::getDerivativeDefinition in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/rest/src/Plugin/Deriver/EntityDeriver.php \Drupal\rest\Plugin\Deriver\EntityDeriver::getDerivativeDefinition()
  2. 8 core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver::getDerivativeDefinition()
Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/Plugin/Deriver/EntityDeriver.php \Drupal\rest\Plugin\Deriver\EntityDeriver::getDerivativeDefinition()

Gets the definition of a derivative plugin.

Parameters

string $derivative_id: The derivative id. The id must uniquely identify the derivative within a given base plugin, but derivative ids can be reused across base plugins.

mixed $base_plugin_definition: The definition of the base plugin from which the derivative plugin is derived. It is maybe an entire object or just some array, depending on the discovery mechanism.

Return value

array The full definition array of the derivative plugin, typically a merge of $base_plugin_definition with extra derivative-specific information. NULL if the derivative doesn't exist.

Overrides DeriverInterface::getDerivativeDefinition

File

core/modules/rest/src/Plugin/Deriver/EntityDeriver.php, line 57
Contains \Drupal\rest\Plugin\Deriver\EntityDeriver.

Class

EntityDeriver
Provides a resource plugin definition for every entity type.

Namespace

Drupal\rest\Plugin\Deriver

Code

public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
  if (!isset($this->derivatives)) {
    $this
      ->getDerivativeDefinitions($base_plugin_definition);
  }
  if (isset($this->derivatives[$derivative_id])) {
    return $this->derivatives[$derivative_id];
  }
}