l

Versions
4.6 – 5
l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE)
6
l($text, $path, $options = array())
7
l($text, $path, array $options = array())

Format an internal Drupal link.

This function correctly handles aliased paths, and allows themes to highlight links to the current page correctly, so all internal links output by modules should be generated by this function if possible.

Parameters

$text The text to be enclosed with the anchor tag.

$path The Drupal path being linked to, such as "admin/node".

$attributes An associative array of HTML attributes to apply to the anchor tag.

$query A query string to append to the link.

$fragment A fragment identifier (named anchor) to append to the link.

$absolute Whether to force the output to be an absolute link (beginning with http:). Useful for links that will be displayed outside the site, such as in an RSS feed.

$html Whether the title is HTML, or just plain-text.

Return value

an HTML string containing a link to the given path.

Related topics

▾ 96 functions call l()

aggregator_block in modules/aggregator.module
Implementation of hook_block().
aggregator_page_categories in modules/aggregator.module
Menu callback; displays all the categories used by the aggregator.
aggregator_page_sources in modules/aggregator.module
Menu callback; displays all the feeds used by the aggregator.
aggregator_view in modules/aggregator.module
archive_calendar in modules/archive.module
Generates a monthly calendar, for display in the archive block.
block_admin_display in modules/block.module
Prepare the main block administration form.
blogapi_blogger_edit_post in modules/blogapi.module
Blogging API callback. Modifies the specified blog node.
blogapi_blogger_new_post in modules/blogapi.module
Blogging API callback. Inserts a new blog post as a node.
blog_block in modules/blog.module
Implementation of hook_block().
blog_form in modules/blog.module
Implementation of hook_form().
blog_link in modules/blog.module
Implementation of hook_link().
blog_page_user in modules/blog.module
Displays a Drupal page containing recent blog entries of a given user.
blog_user in modules/blog.module
Implementation of hook_user().
book_admin_view_line in modules/book.module
book_link in modules/book.module
Implementation of hook_link().
book_render in modules/book.module
Menu callback; prints a listing of all books.
book_tree_recurse in modules/book.module
chameleon_comment in themes/chameleon/chameleon.theme
chameleon_node in themes/chameleon/chameleon.theme
chameleon_page in themes/chameleon/chameleon.theme
comment_admin_overview in modules/comment.module
Menu callback; present an administrative comment listing.
comment_block in modules/comment.module
Implementation of hook_block().
comment_link in modules/comment.module
Implementation of hook_link().
comment_links in modules/comment.module
comment_post in modules/comment.module
comment_threshold_settings in modules/comment.module
Menu callback; displays settings for thresholds at which comments are displayed.
comment_vote_settings in modules/comment.module
Menu callback; displays page for assigning names to vote values.
drupal_access_denied in includes/common.inc
Generates a 403 error if the request is not allowed.
filter_admin_filters in modules/filter.module
Menu callback; configure the filters for a format.
filter_admin_overview in modules/filter.module
Menu callback; allows administrators to set up input formats.
filter_form in modules/filter.module
Generate a selector for choosing a format in a form.
format_name in includes/common.inc
Format a username.
forum_block in modules/forum.module
Implementation of hook_block().
forum_link in modules/forum.module
Implementation of hook_link().
forum_overview in modules/forum.module
Returns an overview list of existing forums and containers
hook_link in developer/hooks/core.php
Define internal Drupal links.
menu_edit_item_form in modules/menu.module
Present the menu item editing form.
menu_edit_item_save in modules/menu.module
Save changes to a menu item into the database.
menu_get_active_breadcrumb in includes/menu.inc
Returns an array of rendered menu items in the active breadcrumb trail.
menu_help in modules/menu.module
Implementation of hook_help().
menu_overview_tree in modules/menu.module
Present the menu tree, rendered along with links to edit menu items.
menu_overview_tree_rows in modules/menu.module
node_add in modules/node.module
Present a node submission form or a set of links to such forms.
node_admin_nodes in modules/node.module
Generate the content administration overview.
node_example_link in developer/examples/node_example.module
Implementation of hook_link().
node_link in modules/node.module
Implementation of hook_link().
node_preview in modules/node.module
Generate a node preview, including a form for further edits.
node_revision_overview in modules/node.module
Generate an overview table of older revisions of a node.
node_submit in modules/node.module
Accepts a submission of new or changed node content.
node_title_list in modules/node.module
Gather a listing of links to nodes.
node_types_configure in modules/node.module
Menu callback; presents each node type configuration page.
path_overview in modules/path.module
Return a listing of all defined URL aliases.
poll_page in modules/poll.module
poll_view in modules/poll.module
Implementation of hook_view().
profile_admin_overview in modules/profile.module
Menu callback; display a listing of all editable profile fields.
profile_view_field in modules/profile.module
queue_overview in modules/queue.module
Display a page listing the nodes in the submission queue.
search_view in modules/search.module
Menu callback; presents the search form and/or search results.
statistics_access_log in modules/statistics.module
statistics_node_tracker in modules/statistics.module
statistics_recent_hits in modules/statistics.module
Menu callback; presents the "Recent hits" page.
statistics_user_tracker in modules/statistics.module
system_theme_listing in modules/system.module
Generate a list of all the available theme/style combinations.
tablesort_header in includes/tablesort.inc
Format a column header.
taxonomy_form_term in modules/taxonomy.module
taxonomy_link in modules/taxonomy.module
Implementation of hook_link().
taxonomy_overview in modules/taxonomy.module
Generate a tabular listing of administrative functions for vocabularies.
theme_aggregator_block_item in modules/aggregator.module
Format an individual feed item for display in the block.
theme_aggregator_feed in modules/aggregator.module
Format a news feed.
theme_aggregator_page_item in modules/aggregator.module
Format an individual feed item for display on the aggregator page.
theme_book_navigation in modules/book.module
Prepares both the custom breadcrumb trail and the forward/backward navigation for a node presented as a book page.
theme_comment in modules/comment.module
theme_comment_folded in modules/comment.module
theme_confirm in includes/theme.inc
Output a confirmation form
theme_forum_display in modules/forum.module
Format the forum body.
theme_forum_list in modules/forum.module
Format the forum listing.
theme_forum_topic_list in modules/forum.module
Format the topic listing.
theme_get_settings in includes/theme.inc
Retrieve an associative array containing the settings for a theme.
theme_menu_item_link in includes/menu.inc
Generate the HTML representing a given menu item ID.
theme_user_picture in modules/user.module
tracker_page in modules/tracker.module
Menu callback. Prints a listing of active nodes on the site.
upload_link in modules/upload.module
Implementation of hook_link().
user_admin_access in modules/user.module
Menu callback: list all access rules
user_admin_account in modules/user.module
user_admin_role in modules/user.module
Menu callback: administer roles.
user_authenticate in modules/user.module
user_auth_help_links in modules/user.module
user_block in modules/user.module
Implementation of hook_block().
user_login in modules/user.module
user_register in modules/user.module
watchdog_event in modules/watchdog.module
Menu callback; displays details about a log message.
watchdog_overview in modules/watchdog.module
Menu callback; displays a listing of log messages.
xtemplate_comment in themes/engines/xtemplate/xtemplate.engine
_locale_admin_manage_screen in includes/locale.inc
User interface for the language management screen
_locale_string_seek in includes/locale.inc
Perform a string search and display results in a table
_statistics_format_item in modules/statistics.module

Code

includes/common.inc, line 1563

<?php
function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
  if (drupal_get_normal_path($path) == $_GET['q']) {
    if (isset($attributes['class'])) {
      $attributes['class'] .= ' active';
    }
    else {
      $attributes['class'] = 'active';
    }
  }
  return '<a href="'. check_url(url($path, $query, $fragment, $absolute)) .'"'. drupal_attributes($attributes) .'>'. ($html ? $text : check_plain($text)) .'</a>';
}
?>
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.