/**
  * Returns links to the current page with different langcodes.
  *
  * Using #type 'link' causes these links to be rendered with l().
  */
 public function typeLinkActiveClass()
 {
     // We assume that 'en' and 'fr' have been configured.
     $languages = $this->languageManager->getLanguages();
     return array('no_language' => array('#type' => 'link', '#title' => t('Link to the current path with no langcode provided.'), '#href' => current_path(), '#options' => array('attributes' => array('id' => 'no_lang_link'), 'set_active_class' => TRUE)), 'fr' => array('#type' => 'link', '#title' => t('Link to a French version of the current path.'), '#href' => current_path(), '#options' => array('language' => $languages['fr'], 'attributes' => array('id' => 'fr_link'), 'set_active_class' => TRUE)), 'en' => array('#type' => 'link', '#title' => t('Link to an English version of the current path.'), '#href' => current_path(), '#options' => array('language' => $languages['en'], 'attributes' => array('id' => 'en_link'), 'set_active_class' => TRUE)));
 }
 /**
  * {@inheritdoc}
  */
 public function getLanguages($flags = LanguageInterface::STATE_CONFIGURABLE)
 {
     if (!isset($this->languages)) {
         // Prepopulate the language list with the default language to keep things
         // working even if we have no configuration.
         $default = $this->getDefaultLanguage();
         $this->languages = array($default->getId() => $default);
         // Retrieve the list of languages defined in configuration.
         $prefix = 'language.entity.';
         $config_ids = $this->configFactory->listAll($prefix);
         // Instantiate languages from config objects.
         $weight = 0;
         foreach ($this->configFactory->loadMultiple($config_ids) as $config) {
             $data = $config->get();
             $langcode = $data['id'];
             // Initialize default property so callers have an easy reference and can
             // save the same object without data loss.
             $data['default'] = $langcode == $default->getId();
             $data['name'] = $data['label'];
             $this->languages[$langcode] = new Language($data);
             $weight = max(array($weight, $this->languages[$langcode]->getWeight()));
         }
         // Add locked languages, they will be filtered later if needed.
         $this->languages += $this->getDefaultLockedLanguages($weight);
         // Sort the language list by weight then title.
         Language::sort($this->languages);
     }
     return parent::getLanguages($flags);
 }