You are here

public function LocalTaskTest::getDerivativeDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTest.php \Drupal\menu_test\Plugin\Derivative\LocalTaskTest::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTest.php, line 17
Contains \Drupal\menu_test\Plugin\Derivative\LocalTaskTest.

Class

LocalTaskTest

Namespace

Drupal\menu_test\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $weight = $base_plugin_definition['weight'];
  foreach (array(
    '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'] = array(
      'placeholder' => $key,
    );
    $this->derivatives[$key]['weight'] = $weight++;

    // ensure weights for testing.
  }
  return $this->derivatives;
}