You are here

public function RenderBuilder::__construct in Admin Toolbar Language Switcher 8

Same name and namespace in other branches
  1. 8.1.x src/RenderBuilder.php \Drupal\toolbar_language_switcher\RenderBuilder::__construct()
  2. 2.0.x src/RenderBuilder.php \Drupal\toolbar_language_switcher\RenderBuilder::__construct()

RenderBuilder constructor.

Parameters

\Drupal\Core\Language\LanguageManagerInterface $language_manager: Language manager.

\Drupal\Core\Path\PathMatcherInterface $path_matcher: Path builder.

File

src/RenderBuilder.php, line 61

Class

RenderBuilder
Class RenderBuilder.

Namespace

Drupal\toolbar_language_switcher

Code

public function __construct(LanguageManagerInterface $language_manager, PathMatcherInterface $path_matcher) {
  $this->languageManager = $language_manager;
  $this->pathMatcher = $path_matcher;

  // Get languages, get current route.
  $this->currentLanguage = $this->languageManager
    ->getCurrentLanguage();
  $this->languages = $this->languageManager
    ->getLanguages();
  $this->route = $this->pathMatcher
    ->isFrontPage() ? '<front>' : '<current>';
}