Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function build()
 {
     $build = array();
     $route_name = $this->pathMatcher->isFrontPage() ? '<front>' : '<current>';
     $type = $this->getDerivativeId();
     $links = $this->languageManager->getLanguageSwitchLinks($type, Url::fromRoute($route_name));
     if (isset($links->links)) {
         $build = array('#theme' => 'links__language_block', '#links' => $links->links, '#attributes' => array('class' => array("language-switcher-{$links->method_id}")), '#set_active_class' => TRUE);
     }
     return $build;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function build()
 {
     $build = array();
     $path = drupal_is_front_page() ? '<front>' : current_path();
     $type = $this->getDerivativeId();
     $links = $this->languageManager->getLanguageSwitchLinks($type, $path);
     if (isset($links->links)) {
         $build = array('#theme' => 'links__language_block', '#links' => $links->links, '#attributes' => array('class' => array("language-switcher-{$links->method_id}")), '#set_active_class' => TRUE);
     }
     return $build;
 }