drupal_is_front_page

Versions
4.7 – 7
drupal_is_front_page()

Check if the current page is the front page.

Return value

Boolean value: TRUE if the current page is the front page; FALSE if otherwise.

▾ 9 functions call drupal_is_front_page()

l in includes/common.inc
Format an internal Drupal link.
locale_block_view in modules/locale/locale.module
Implement hook_block_view().
menu_get_active_breadcrumb in includes/menu.inc
Get the breadcrumb for the current page, as determined by the active trail.
menu_set_active_trail in includes/menu.inc
Sets or gets the active trail (path to root menu root) of the current page.
menu_tree_page_data in includes/menu.inc
Get the data structure representing a named menu tree, based on the current page.
system_test_init in modules/simpletest/tests/system_test.module
Implement hook_init().
template_page_suggestions in includes/theme.inc
Generate an array of page template suggestions.
template_preprocess in includes/theme.inc
Adds a default set of helper variables for variable processors and templates. This comes in before any other preprocess function which makes it possible to be used in default theme implementations (non-overriden theme functions).
theme_links in includes/theme.inc
Return a themed set of links.

Code

includes/path.inc, line 325

<?php
function drupal_is_front_page() {
  // Use the advanced drupal_static() pattern, since this is called very often.
  static $drupal_static = array();
  isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
  $is_front_page = &$drupal_static[__FUNCTION__];

  if (!isset($is_front_page)) {
    // As drupal_path_initialize updates $_GET['q'] with the 'site_frontpage' path,
    // we can check it against the 'site_frontpage' variable.
    $is_front_page = ($_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')));
  }

  return $is_front_page;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.