Version 1
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Plugin / Discovery / TestDerivativeDiscovery.php
1 <?php
2
3 namespace Drupal\Tests\Core\Plugin\Discovery;
4
5 use Drupal\Component\Plugin\Derivative\DeriverInterface;
6
7 /**
8  * Defines test derivative discovery.
9  */
10 class TestDerivativeDiscovery implements DeriverInterface {
11
12   /**
13    * {@inheritdoc}
14    */
15   public function getDerivativeDefinition($derivative_id, $base_plugin_definition) {
16     $definitions = $this->getDerivativeDefinitions($base_plugin_definition);
17     return $definitions[$derivative_id];
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   public function getDerivativeDefinitions($base_plugin_definition) {
24     $plugins = [];
25     for ($i = 0; $i < 2; $i++) {
26       $plugins['test_discovery_' . $i] = $base_plugin_definition;
27     }
28     return $plugins;
29   }
30
31 }