function MenuExampleController::placeholderArgs

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

Demonstrates how you can provide a placeholder url arguments.

Throws

\InvalidArgumentException

See also

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

https://www.drupal.org/docs/8/api/routing-system/using-parameters-in-ro…

1 string reference to 'MenuExampleController::placeholderArgs'
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 232

Class

MenuExampleController
Controller routines for menu example routes.

Namespace

Drupal\menu_example\Controller

Code

public function placeholderArgs() {
    $url = Url::fromRoute('examples.menu_example.placeholder_argument.display', [
        'arg' => 3343,
    ]);
    return [
        '#markup' => $this->t('Demonstrate placeholders by visiting @link', [
            '@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName(), $url->getRouteParameters())
                ->toString(),
        ]),
    ];
}