function MenuExampleController::titleCallback

Same name in other branches
  1. 4.0.x modules/menu_example/src/Controller/MenuExampleController.php \Drupal\menu_example\Controller\MenuExampleController::titleCallback()

Generates title dynamically.

See also

\Drupal\menu_example\Controller\MenuExampleController::titleCallback()

1 string reference to 'MenuExampleController::titleCallback'
menu_example.routing.yml in modules/menu_example/menu_example.routing.yml
modules/menu_example/menu_example.routing.yml

File

modules/menu_example/src/Controller/MenuExampleController.php, line 216

Class

MenuExampleController
Controller routines for menu example routes.

Namespace

Drupal\menu_example\Controller

Code

public function titleCallback() {
    return [
        '#markup' => $this->t('The new title is your username: @name', [
            '@name' => $this->currentUser()
                ->getDisplayName(),
        ]),
    ];
}