You are here

function toolbar_language_switcher_toolbar in Admin Toolbar Language Switcher 8.1.x

Same name and namespace in other branches
  1. 8 toolbar_language_switcher.module \toolbar_language_switcher_toolbar()
  2. 2.0.x toolbar_language_switcher.module \toolbar_language_switcher_toolbar()

Implements hook_toolbar().

File

./toolbar_language_switcher.module, line 11
Contains module functionality.

Code

function toolbar_language_switcher_toolbar() {
  $user = \Drupal::currentUser();
  if ($user
    ->hasPermission('use toolbar_language_switcher')) {
    return \Drupal::service('tls.render.builder')
      ->build();
  }
  return [];
}