function MenuExampleController::routeOnly

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

Give the user a link to the route-only page.

Throws

\InvalidArgumentException

1 string reference to 'MenuExampleController::routeOnly'
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 119

Class

MenuExampleController
Controller routines for menu example routes.

Namespace

Drupal\menu_example\Controller

Code

public function routeOnly() {
    $url = Url::fromRoute('examples.menu_example.route_only.callback');
    return [
        '#markup' => $this->t('A menu entry with no menu link is at @link', [
            '@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName())
                ->toString(),
        ]),
    ];
}