You are here

public function TestDataTypeDeriver::getDerivativeDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php \Drupal\Tests\Core\Plugin\Fixtures\Plugin\DataType\TestDataTypeDeriver::getDerivativeDefinitions()

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

core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php, line 15

Class

TestDataTypeDeriver
Provides a deriver that returns a plugin for the bare ID and one variant.

Namespace

Drupal\Tests\Core\Plugin\Fixtures\Plugin\DataType

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ([
    '',
    'a_variant',
  ] as $item) {
    $this->derivatives[$item] = $base_plugin_definition;
    $this->derivatives[$item]['provider'] = 'core';
  }
  return $this->derivatives;
}