function LocalTaskTest::getDerivativeDefinitions

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTest.php \Drupal\menu_test\Plugin\Derivative\LocalTaskTest::getDerivativeDefinitions()
  2. 8.9.x core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTest.php \Drupal\menu_test\Plugin\Derivative\LocalTaskTest::getDerivativeDefinitions()
  3. 10 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTest.php \Drupal\menu_test\Plugin\Derivative\LocalTaskTest::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTest.php, line 12

Class

LocalTaskTest

Namespace

Drupal\menu_test\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    $weight = $base_plugin_definition['weight'];
    foreach ([
        'derive1' => 'Derive 1',
        'derive2' => 'Derive 2',
    ] as $key => $title) {
        $this->derivatives[$key] = $base_plugin_definition;
        $this->derivatives[$key]['title'] = $title;
        $this->derivatives[$key]['route_parameters'] = [
            'placeholder' => $key,
        ];
        // Ensure weights for testing.
        $this->derivatives[$key]['weight'] = $weight++;
    }
    return $this->derivatives;
}

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