Version 1
[yaffs-website] / web / core / modules / system / tests / modules / paramconverter_test / src / TestControllers.php
1 <?php
2
3 namespace Drupal\paramconverter_test;
4
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\node\NodeInterface;
7
8 /**
9  * Controller routine for testing the paramconverter.
10  */
11 class TestControllers {
12
13   public function testUserNodeFoo(EntityInterface $user, NodeInterface $node, $foo) {
14     $foo = is_object($foo) ? $foo->label() : $foo;
15     return ['#markup' => "user: {$user->label()}, node: {$node->label()}, foo: $foo"];
16   }
17
18   public function testNodeSetParent(NodeInterface $node, NodeInterface $parent) {
19     return ['#markup' => "Setting '{$parent->label()}' as parent of '{$node->label()}'."];
20   }
21
22   public function testEntityLanguage(NodeInterface $node) {
23     $build = ['#markup' => $node->label()];
24     \Drupal::service('renderer')->addCacheableDependency($build, $node);
25     return $build;
26   }
27
28 }