You are here

public function EntityPost::getDerivativeDefinitions in Services 9.0.x

Same name and namespace in other branches
  1. 8.4 src/Plugin/Deriver/EntityPost.php \Drupal\services\Plugin\Deriver\EntityPost::getDerivativeDefinitions()

File

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

Class

EntityPost
Class \Drupal\services\Plugin\Deriver\EntityPost.

Namespace

Drupal\services\Plugin\Deriver

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    $this->derivatives[$entity_type_id] = $base_plugin_definition;
    $this->derivatives[$entity_type_id]['title'] = $this
      ->t('@label: Create', [
      '@label' => $entity_type
        ->getLabel(),
    ]);
    $this->derivatives[$entity_type_id]['description'] = $this
      ->t('Creates a @entity_type_id object and returns its id.', [
      '@entity_type_id' => $entity_type_id,
    ]);
    $this->derivatives[$entity_type_id]['category'] = $this
      ->t('@label', [
      '@label' => $entity_type
        ->getLabel(),
    ]);
    $this->derivatives[$entity_type_id]['path'] = $entity_type_id;
  }
  return $this->derivatives;
}