You are here

public function EntityBundle::getDerivativeDefinitions in Chaos Tool Suite (ctools) 8.3

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Deriver/EntityBundle.php, line 15

Class

EntityBundle
Deriver that creates a condition for each entity type with bundles.

Namespace

Drupal\ctools\Plugin\Deriver

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($entity_type
      ->hasKey('bundle')) {
      $this->derivatives[$entity_type_id] = $base_plugin_definition;
      $this->derivatives[$entity_type_id]['label'] = $this
        ->getEntityBundleLabel($entity_type);
      $this->derivatives[$entity_type_id]['context_definitions'] = [
        "{$entity_type_id}" => new EntityContextDefinition('entity:' . $entity_type_id),
      ];
    }
  }
  return $this->derivatives;
}