function drupal_is_front_page

You are here

7 path.inc drupal_is_front_page()
4.7 path.inc drupal_is_front_page()
5 path.inc drupal_is_front_page()
6 path.inc drupal_is_front_page()
8 path.inc 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.

10 calls to drupal_is_front_page()
hook_page_build in core/modules/system/system.api.php
Add elements to a page before it is rendered.
LanguageBlock::build in core/modules/language/lib/Drupal/language/Plugin/Block/LanguageBlock.php
Builds and returns the renderable array for this block plugin.
LinkGeneratorTest.php in core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
Contains \Drupal\Tests\Core\Utility\LinkGeneratorTest.
system_page_build in core/modules/system/system.module
Implements hook_page_build().
system_test_page_build in core/modules/system/tests/modules/system_test/system_test.module
Implements hook_page_build().

... See full list

1 string reference to 'drupal_is_front_page'
LinkGeneratorTest.php in core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
Contains \Drupal\Tests\Core\Utility\LinkGeneratorTest.

File

core/includes/path.inc, line 19
Functions to handle paths in Drupal.

Code

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

  if (!isset($is_front_page)) {
    $is_front_page = (current_path() == \Drupal::config('system.site')->get('page.front'));
  }

  return $is_front_page;
}