You are here

public function LocalTaskTestWithUnsafeTitle::getDerivativeDefinitions in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTestWithUnsafeTitle.php \Drupal\menu_test\Plugin\Derivative\LocalTaskTestWithUnsafeTitle::getDerivativeDefinitions()
  2. 9 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTestWithUnsafeTitle.php \Drupal\menu_test\Plugin\Derivative\LocalTaskTestWithUnsafeTitle::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/LocalTaskTestWithUnsafeTitle.php, line 17

Class

LocalTaskTestWithUnsafeTitle
Test derivative to check local task title escaping.

Namespace

Drupal\menu_test\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives['unsafe'] = [
    'title' => "<script>alert('Welcome to the derived jungle!')</script>",
    'route_parameters' => [
      'bar' => 'unsafe',
    ],
  ] + $base_plugin_definition;
  return $this->derivatives;
}