You are here

public function MenuExampleController::tabsPage in Examples for Developers 8

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

Uses the path and title to determine the page content.

This controller is mapped dynamically based on the 'route_callbacks:' key in the routing YAML file.

Parameters

string $path: Path/URL of menu item.

string $title: Title of menu item.

Return value

array Controller response.

See also

Drupal\menu_example\Routing\MenuExampleDynamicRoutes

File

menu_example/src/Controller/MenuExampleController.php, line 153

Class

MenuExampleController
Controller routines for menu example routes.

Namespace

Drupal\menu_example\Controller

Code

public function tabsPage($path, $title) {
  $secondary = substr_count($path, '/') > 2 ? 'secondary ' : '';
  return [
    '#markup' => $this
      ->t('This is the @secondary tab "@tabname" in the "basic tabs" example.', [
      '@secondary' => $secondary,
      '@tabname' => $title,
    ]),
  ];
}