Hi all,
I'm trying to customize my frontpage in the page template. I tried to use $is_front, which appears to be set by calling drupal_is_front_page(). This function simply checks if the request is empty. This doesn't work with i18n when I'm switching the language of the frontpage, because then the request URL will contain the language prefix. So instead of www.example.com it will be www.example.com/en.
First I wrote my own function by borrowing some code from i18n, but then I discovered that breadcrumbs don't work as expected once I've switched the language of the front page, so I put this code directly into drupal_is_front_page():
function drupal_is_front_page() {
// As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path,
// rely on $_REQUEST to verify the original value of 'q'.
if (!isset($_REQUEST['q']))
return true;
$lang = _i18n_get_lang();
$q = $_REQUEST['q'];
$languages = i18n_supported_languages();
return array_key_exists($q, $languages);
}
This will correctly identify the front page for an empty request and all requests that consist only of valid language identifiers. However, I guess the proper way would be to put this in the i18n module and have it override the default function, but I'm not sure how to do this yet. (still a newbie...)