You are here

public function PluginCollectionItemDeriver::getDerivativeDefinitions in Plugin 8.2

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/Field/FieldType/PluginCollectionItemDeriver.php, line 42

Class

PluginCollectionItemDeriver
Derives plugin collection field items.

Namespace

Drupal\plugin\Plugin\Field\FieldType

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->pluginTypeManager
    ->getPluginTypes() as $plugin_type) {
    if ($plugin_type
      ->isFieldType()) {
      $this->derivatives[$plugin_type
        ->getId()] = [
        'description' => $plugin_type
          ->getDescription(),
        'label' => $plugin_type
          ->getLabel(),
        'plugin_type_id' => $plugin_type
          ->getId(),
      ] + $base_plugin_definition;
    }
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}