You are here

public function FrontendEnvironmentTitleController::frontendDeploymentTitle in Build Hooks 3.x

Same name and namespace in other branches
  1. 8.2 src/Controller/FrontendEnvironmentTitleController.php \Drupal\build_hooks\Controller\FrontendEnvironmentTitleController::frontendDeploymentTitle()

Get the title of frontend environment from current route.

Return value

string The name of the frontend environment.

1 string reference to 'FrontendEnvironmentTitleController::frontendDeploymentTitle'
build_hooks.routing.yml in ./build_hooks.routing.yml
build_hooks.routing.yml

File

src/Controller/FrontendEnvironmentTitleController.php, line 18

Class

FrontendEnvironmentTitleController
Controller for route titles.

Namespace

Drupal\build_hooks\Controller

Code

public function frontendDeploymentTitle() {
  $path = \Drupal::request()
    ->getpathInfo();
  $arg = explode('/', $path);
  $config = \Drupal::config('build_hooks.frontend_environment.' . $arg[4]);
  return $this
    ->t('@env environment deployment', [
    '@env' => $config
      ->get('label'),
  ]);
}