3 namespace Drupal\menu_test\Plugin\Derivative;
5 use Drupal\Component\Plugin\Derivative\DeriverBase;
7 class LocalTaskTest extends DeriverBase {
12 public function getDerivativeDefinitions($base_plugin_definition) {
13 $weight = $base_plugin_definition['weight'];
14 foreach (['derive1' => 'Derive 1', 'derive2' => 'Derive 2'] as $key => $title) {
15 $this->derivatives[$key] = $base_plugin_definition;
16 $this->derivatives[$key]['title'] = $title;
17 $this->derivatives[$key]['route_parameters'] = ['placeholder' => $key];
18 // Ensure weights for testing.
19 $this->derivatives[$key]['weight'] = $weight++;
21 return $this->derivatives;