Version 1
[yaffs-website] / web / core / modules / system / tests / modules / paramconverter_test / src / TestControllers.php
diff --git a/web/core/modules/system/tests/modules/paramconverter_test/src/TestControllers.php b/web/core/modules/system/tests/modules/paramconverter_test/src/TestControllers.php
new file mode 100644 (file)
index 0000000..6ea4306
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Drupal\paramconverter_test;
+
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\node\NodeInterface;
+
+/**
+ * Controller routine for testing the paramconverter.
+ */
+class TestControllers {
+
+  public function testUserNodeFoo(EntityInterface $user, NodeInterface $node, $foo) {
+    $foo = is_object($foo) ? $foo->label() : $foo;
+    return ['#markup' => "user: {$user->label()}, node: {$node->label()}, foo: $foo"];
+  }
+
+  public function testNodeSetParent(NodeInterface $node, NodeInterface $parent) {
+    return ['#markup' => "Setting '{$parent->label()}' as parent of '{$node->label()}'."];
+  }
+
+  public function testEntityLanguage(NodeInterface $node) {
+    $build = ['#markup' => $node->label()];
+    \Drupal::service('renderer')->addCacheableDependency($build, $node);
+    return $build;
+  }
+
+}