A common way to get the cover page of another language, in multilingual drupal?

The Drupal $ front_page parameter contains the URL of the home page for the current language. I am looking for a general way to get this URL for another different language.

I would like to work in all cases - in any of the alternative options for the negotiation process, as well as if it was indicated on the main page to point to another node.

I did not find the documentation for anything available in the kernel or in the i18n module. Did I miss something?

+3
source share
1 answer

You simply use the parameter '<front>'for the URL and language so that it prints all the URLs of the front pages on the site.

$languages = language_list();
foreach ($languages as $langcode => $language) {
    print url('<front>', array('language' => $language)); 
}

, l(). , url/l, .

+4

Source: https://habr.com/ru/post/1719068/


All Articles