menu_get_active_title

5 menu.inc menu_get_active_title()
6 menu.inc menu_get_active_title()
7 menu.inc menu_get_active_title()
8 menu.inc menu_get_active_title()

Get the title of the current page, as determined by the active trail.

Related topics

1 call to menu_get_active_title()

1 string reference to 'menu_get_active_title'

File

includes/menu.inc, line 1630
API for the Drupal menu system.

Code

function menu_get_active_title() {
  $active_trail = menu_get_active_trail();

  foreach (array_reverse($active_trail) as $item) {
    if (!(bool) ($item['type'] & MENU_IS_LOCAL_TASK)) {
      return $item['title'];
    }
  }
}

Comments

Return value is unsanitized HTML

Beware: the return value of this function is interpreted as HTML. If you are printing the result of this function in your code or theme, you must escape them with check_plain or use the correct placeholder in t(). If you don't, users can execute a cross site scripting attack against your site.

<?php
// Incorrect:
print menu_get_active_title();

// Correct:
print check_plain(menu_get_active_trail());
?>

Login or register to post comments