function TestDerivativeDiscovery::getDerivativeDefinitions

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php \Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery::getDerivativeDefinitions()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php \Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery::getDerivativeDefinitions()
  3. 9 core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php \Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery::getDerivativeDefinitions()
  4. 8.9.x core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php \Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array|\Drupal\Component\Plugin\Definition\PluginDefinitionInterface $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 An array of full derivative definitions keyed on derivative id.

Overrides DeriverInterface::getDerivativeDefinitions

1 call to TestDerivativeDiscovery::getDerivativeDefinitions()
TestDerivativeDiscovery::getDerivativeDefinition in core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php
Gets the definition of a derivative plugin.

File

core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php, line 25

Class

TestDerivativeDiscovery
Defines test derivative discovery.

Namespace

Drupal\Tests\Core\Plugin\Discovery

Code

public function getDerivativeDefinitions($base_plugin_definition) : array {
  $plugins = [];
  for ($i = 0; $i < 2; $i++) {
    $plugins['test_discovery_' . $i] = $base_plugin_definition;
  }
  return $plugins;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.