1 path.inc backdrop_is_front_page()

Check if the current page is the home page.

Return value

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


core/includes/path.inc, line 267
Functions to handle paths in Backdrop, including URL aliasing.


function backdrop_is_front_page() {
  // Use the advanced backdrop_static() pattern, since this is called very often.
  static $backdrop_static_fast;
  if (!isset($backdrop_static_fast)) {
    $backdrop_static_fast['is_front_page'] = &backdrop_static(__FUNCTION__);
  $is_front_page = &$backdrop_static_fast['is_front_page'];

  if (!isset($is_front_page)) {
    // As backdrop_path_initialize updates $_GET['q'] with the 'site_frontpage' path,
    // we can check it against the 'site_frontpage' variable.
    $is_front_page = ($_GET['q'] == config_get('system.core', 'site_frontpage'));

  return $is_front_page;