You are here

class LocalTaskTestWithUnsafeTitle in Drupal 9

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

Test derivative to check local task title escaping.

Hierarchy

Expanded class hierarchy of LocalTaskTestWithUnsafeTitle

See also

\Drupal\system\Tests\Menu\LocalTasksTest

1 string reference to 'LocalTaskTestWithUnsafeTitle'
menu_test.links.task.yml in core/modules/system/tests/modules/menu_test/menu_test.links.task.yml
core/modules/system/tests/modules/menu_test/menu_test.links.task.yml

File

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

Namespace

Drupal\menu_test\Plugin\Derivative
View source
class LocalTaskTestWithUnsafeTitle extends DeriverBase {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
LocalTaskTestWithUnsafeTitle::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions