Reviewed & tested by the community
Project:
Localizer
Version:
5.x-1.9
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
24 Jul 2007 at 12:47 UTC
Updated:
25 Jul 2007 at 08:25 UTC
I have coded a new localizated function to replace drupal_is_front_page():
<?php
/**
* Check if the current localizated page is the front page.
* @return
* TRUE if the current page is the front page; FALSE if otherwise.
*/
function localizer_is_front_page() {
// Test frontpage_redirect option
if (variable_get('localizer_frontpage_redirect', TRUE)) {
$locale = localizer_get_uilocale();
// Get site_frontpage localizated
$front = localizernode_get_localizedpath(variable_get('site_frontpage', 'node'), $locale);
return (localizer_get_destination($locale) == $front);
}
else {
return drupal_is_front_page();
}
}
?>
It could be useful, by example, in block visibility tests:
<?php
return (module_exists('localizer') ? localizer_is_front_page() : drupal_is_front_page());
?>
Comments
Comment #1
Roberto Gerola commentedAdded to dev branch.
Many thanks.