function drupal_set_title

8.x drupal_set_title($title = NULL, $output = CHECK_PLAIN)

Sets the title of the current page.

The title is displayed on the page and in the title bar.


$title: Optional string value to assign to the page title; or if set to NULL (default), leaves the current title unchanged.

$output: Optional flag - normally should be left as CHECK_PLAIN. Only set to PASS_THROUGH if you have already removed any possibly dangerous code from $title using a function like check_plain() or filter_xss(). With this flag the string will be passed through unchanged.

Return value

The updated title of the current page.

25 calls to drupal_set_title()
authorize_access_denied_page in drupal/core/authorize.php
Renders a 403 access denied page for authorize.php.
ConfirmFormBase::buildForm in drupal/core/lib/Drupal/Core/Form/ConfirmFormBase.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
confirm_form in drupal/core/modules/system/system.module
Generates a form array for a confirmation form.
drupal_get_title in drupal/core/includes/
Gets the title of the current page.
entity_test_add in drupal/core/modules/system/tests/modules/entity_test/entity_test.module
Menu callback: displays the 'Add new entity_test' form.

... See full list


drupal/core/includes/, line 1722
Functions that need to be loaded on every Drupal request.


function drupal_set_title($title = NULL, $output = CHECK_PLAIN) {
  $stored_title = &drupal_static(__FUNCTION__);

  if (isset($title)) {
    $stored_title = ($output == PASS_THROUGH) ? $title : check_plain($title);

  return $stored_title;