3 namespace Drupal\Tests\Core\Plugin\Discovery;
5 use Drupal\Component\Plugin\Derivative\DeriverInterface;
8 * Defines test derivative discovery using an object..
10 class TestDerivativeDiscoveryWithObject implements DeriverInterface {
14 * @param string $derivative_id
15 * @param array $base_plugin_definition
18 public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
19 $definitions = $this->getDerivativeDefinitions($base_plugin_definition);
20 return $definitions[$derivative_id];
25 * @param array $base_plugin_definition
28 public function getDerivativeDefinitions($base_plugin_definition) {
30 for ($i = 0; $i < 2; $i++) {
31 $plugins['test_discovery_' . $i] = $base_plugin_definition;