Version 1
[yaffs-website] / web / core / modules / system / tests / modules / menu_test / src / Plugin / Derivative / MenuLinkTestWithUnsafeTitle.php
diff --git a/web/core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/MenuLinkTestWithUnsafeTitle.php b/web/core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/MenuLinkTestWithUnsafeTitle.php
new file mode 100644 (file)
index 0000000..822224c
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\menu_test\Plugin\Derivative;
+
+use Drupal\Component\Plugin\Derivative\DeriverBase;
+
+/**
+ * Test derivative with an unsafe string.
+ */
+class MenuLinkTestWithUnsafeTitle extends DeriverBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getDerivativeDefinitions($base_plugin_definition) {
+    $this->derivatives['unsafe'] = [
+        'title' => '<script>alert("Even more wild animals")</script>',
+        'menu_name' => 'tools',
+      ] + $base_plugin_definition;
+
+    return $this->derivatives;
+  }
+
+}