3 namespace Drupal\token_module_test\Controller;
5 use Drupal\Core\Controller\ControllerBase;
6 use Symfony\Component\HttpFoundation\Request;
8 class TokenTreeBrowseController extends ControllerBase {
11 * Page callback to output a link.
13 function outputLink(Request $request) {
14 $build['tree']['#theme'] = 'token_tree_link';
15 $build['tokenarea'] = [
16 '#markup' => \Drupal::token()->replace('[current-page:title]'),
23 * Title callback for the page outputting a link.
25 * We are using a title callback instead of directly defining the title in the
26 * routing YML file. This is so that we could return an array instead of a
27 * simple string. This allows us to test if [current-page:title] works with
28 * render arrays and other objects as titles.
30 public function getTitle() {
33 '#markup' => 'Available Tokens',