Version 1
[yaffs-website] / web / core / modules / system / tests / modules / menu_test / src / Plugin / Derivative / LocalTaskTestWithUnsafeTitle.php
diff --git a/web/core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTestWithUnsafeTitle.php b/web/core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalTaskTestWithUnsafeTitle.php
new file mode 100644 (file)
index 0000000..b0652e6
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace Drupal\menu_test\Plugin\Derivative;
+
+use Drupal\Component\Plugin\Derivative\DeriverBase;
+
+/**
+ * Test derivative to check local task title escaping.
+ *
+ * @see \Drupal\system\Tests\Menu\LocalTasksTest
+ */
+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;
+  }
+
+}