l

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 l($text, $path, $options = array())
drupal7 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.

Übergabeparameter

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

$path The Drupal path being linked to, such as "admin/content/node". Can be an external or internal URL.

  • If you provide the full URL, it will be considered an external URL.
  • If you provide only the path (e.g. "admin/content/node"), it is considered an internal link. In this case, it must be a system URL as the url() function will generate the alias.
  • If you provide '<front>', it generates a link to the site's base URL (again via the url() function).
  • If you provide a path, and 'alias' is set to TRUE (see below), it is used as is.

$options An associative array of additional options, with the following keys:

  • 'attributes' An associative array of HTML attributes to apply to the anchor tag.
  • 'query' A query string to append to the link, or an array of query key/value properties.
  • 'fragment' A fragment identifier (named anchor) to append to the link. Do not include the '#' character.
  • 'absolute' (default FALSE) 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' (default FALSE) Whether $text is HTML, or just plain-text. For example for making an image a link, this must be set to TRUE, or else you will see the escaped HTML.
  • 'alias' (default FALSE) Whether the given path is an alias already.

Rückgabewert

an HTML string containing a link to the given path.

▾ 110 functions call l()

actions_synchronize in includes/actions.inc
Synchronize actions that are provided by modules.
aggregator_aggregator_parse in modules/aggregator/aggregator.parser.inc
Implementation of hook_aggregator_parse().
aggregator_form_category_submit in modules/aggregator/aggregator.admin.inc
Process aggregator_form_category form submissions.
aggregator_form_feed_submit in modules/aggregator/aggregator.admin.inc
Process aggregator_form_feed() form submissions.
aggregator_view in modules/aggregator/aggregator.admin.inc
Displays the aggregator administration page.
block_admin_display_form in modules/block/block.admin.inc
Generate main blocks administration form.
blogapi_blogger_edit_post in modules/blogapi/blogapi.module
Blogging API callback. Modifies the specified blog node.
blogapi_blogger_new_post in modules/blogapi/blogapi.module
Blogging API callback. Inserts a new blog post as a node.
blog_page_last in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of all users.
blog_page_user in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
blog_user_view in modules/blog/blog.module
Implementation of hook_user_view().
blog_view in modules/blog/blog.module
Implementation of hook_view().
BookTestCase::checkBookNode in modules/book/book.test
Check the outline of sub-pages; previous, up, and next; and printer friendly version.
book_admin_edit_submit in modules/book/book.admin.inc
Handle submission of the book administrative page form.
book_admin_overview in modules/book/book.admin.inc
Returns an administrative overview of all books.
book_render in modules/book/book.pages.inc
Menu callback; prints a listing of all books.
comment_admin_overview in modules/comment/comment.admin.inc
Form builder; Builds the comment overview form for the admin.
comment_admin_overview_submit in modules/comment/comment.admin.inc
Process comment_admin_overview form submissions.
comment_reply in modules/comment/comment.pages.inc
This function is responsible for generating a comment reply form. There are several cases that have to be handled, including:
comment_save in modules/comment/comment.module
Accepts a submission of new or changed comment content.
CommonLUnitTest::testLXSS in modules/simpletest/tests/common.test
Confirm that invalid text given as $path is filtered.
confirm_form in modules/system/system.module
Output a confirmation form
contact_admin_categories in modules/contact/contact.admin.inc
Categories/list tab.
contact_admin_edit_submit in modules/contact/contact.admin.inc
Process the contact category edit page form submission.
dblog_event in modules/dblog/dblog.admin.inc
Menu callback; displays details about a log message.
dblog_overview in modules/dblog/dblog.admin.inc
Menu callback; displays a listing of log messages.
filter_admin_overview in modules/filter/filter.admin.inc
Menu callback; Displays a list of all text formats and which one is the default.
forum_node_view in modules/forum/forum.module
Implementation of hook_node_view().
forum_overview in modules/forum/forum.admin.inc
Returns an overview list of existing forums and containers
help_links_as_list in modules/help/help.admin.inc
hook_requirements in modules/system/system.api.php
Check installation requirements and do status reporting.
locale_update_6005 in modules/locale/locale.install
Change language setting variable of content types.
menu_edit_item in modules/menu/menu.admin.inc
Menu callback; Build the menu link editing form.
menu_get_active_breadcrumb in includes/menu.inc
Get the breadcrumb for the current page, as determined by the active trail.
menu_overview_page in modules/menu/menu.admin.inc
Menu callback which shows an overview page of all the custom menus and their descriptions.
node_admin_nodes in modules/node/node.admin.inc
Form builder: Builds the node administration overview.
node_form_submit in modules/node/node.pages.inc
node_overview_types in modules/node/content_types.inc
Displays the content type admin overview page.
node_revision_overview in modules/node/node.pages.inc
Generate an overview table of older revisions of a node.
node_title_list in modules/node/node.module
Gather a listing of links to nodes.
node_type_form_submit in modules/node/content_types.inc
Implementation of hook_form_submit().
openid_user_identities in modules/openid/openid.pages.inc
Menu callback; Manage OpenID identities for the specified user.
path_admin_overview in modules/path/path.admin.inc
Return a listing of all defined URL aliases. When filter key passed, perform a standard search on the given key, and return the list of matching URL aliases.
php_install in modules/php/php.install
Implementation of hook_install().
poll_page in modules/poll/poll.pages.inc
Menu callback to provide a simple list of all polls available.
profile_admin_overview in modules/profile/profile.admin.inc
Form builder to display a listing of all editable profile fields.
profile_block_view in modules/profile/profile.module
Implementation of hook_block_view().
profile_field_delete_submit in modules/profile/profile.admin.inc
Process a field delete form submission.
profile_field_form_submit in modules/profile/profile.admin.inc
Process profile_field_form submissions.
profile_view_field in modules/profile/profile.module
search_view in modules/search/search.pages.inc
Menu callback; presents the search form and/or search results.
simpletest_result_form in modules/simpletest/simpletest.pages.inc
Test results form for $test_id.
statistics_access_log in modules/statistics/statistics.admin.inc
Menu callback; Displays recent page accesses.
statistics_node_tracker in modules/statistics/statistics.pages.inc
statistics_recent_hits in modules/statistics/statistics.admin.inc
Menu callback; presents the "recent hits" page.
statistics_top_visitors in modules/statistics/statistics.admin.inc
Menu callback; presents the "top visitors" page.
statistics_user_tracker in modules/statistics/statistics.pages.inc
system_actions_manage in modules/system/system.module
Menu callback. Display an overview of available and configured actions.
system_admin_by_module in modules/system/system.admin.inc
Menu callback; prints a listing of admin tasks for each installed module.
system_get_module_admin_tasks in modules/system/system.module
Generate a list of tasks offered by a specified module.
system_ip_blocking in modules/system/system.admin.inc
Menu callback. Display blocked IP addresses.
system_requirements in modules/system/system.install
Test and report Drupal installation requirements.
system_themes_form in modules/system/system.admin.inc
Menu callback; displays a listing of all themes.
system_update_7013 in modules/system/system.install
Convert default time zone offset to default time zone name.
tablesort_header in includes/tablesort.inc
Format a column header.
taxonomy_form_term_submit in modules/taxonomy/taxonomy.admin.inc
Submit handler to insert or update a term.
taxonomy_form_vocabulary_submit in modules/taxonomy/taxonomy.admin.inc
Accept the form submission for a vocabulary and save the results.
taxonomy_overview_terms in modules/taxonomy/taxonomy.admin.inc
Form builder for the taxonomy terms overview.
taxonomy_overview_vocabularies in modules/taxonomy/taxonomy.admin.inc
Form builder to list and manage vocabularies.
taxonomy_term_page in modules/taxonomy/taxonomy.pages.inc
Menu callback; displays all nodes associated with a term.
template_preprocess_aggregator_feed_source in modules/aggregator/aggregator.pages.inc
Process variables for aggregator-feed-source.tpl.php.
template_preprocess_aggregator_item in modules/aggregator/aggregator.pages.inc
Process variables for aggregator-item.tpl.php.
template_preprocess_comment in modules/comment/comment.module
Process variables for comment.tpl.php.
template_preprocess_comment_folded in modules/comment/comment.module
Process variables for comment-folded.tpl.php.
template_preprocess_forums in modules/forum/forum.module
Process variables for forums.tpl.php
template_preprocess_forum_topic_list in modules/forum/forum.module
Preprocess variables to format the topic listing.
template_preprocess_user_picture in modules/user/user.module
Process variables for user-picture.tpl.php.
theme_admin_block_content in modules/system/system.admin.inc
This function formats the content of an administrative block.
theme_book_admin_table in modules/book/book.admin.inc
Theme function for the book administration page form.
theme_book_title_link in modules/book/book.module
Generate the HTML output for a link to a book title when used as a block title.
theme_comment_block in modules/comment/comment.module
Returns a formatted list of recent comments to be displayed in the comment block.
theme_filter_tips_more_info in modules/filter/filter.module
Format a link to the more extensive filter tips.
theme_links in includes/theme.inc
Return a themed set of links.
theme_locale_languages_overview_form in includes/locale.inc
Theme the language overview form.
theme_menu_item_link in includes/menu.inc
Generate the HTML output for a single menu link.
theme_node_add_list in modules/node/node.pages.inc
Display the list of available node types for node creation.
theme_pager_link in includes/pager.inc
Format a link to a specific query result page.
theme_system_compact_link in modules/system/system.module
Display the link to show or hide inline help descriptions.
theme_system_powered_by in modules/system/system.module
Format the Powered by Drupal text.
theme_update_report in modules/update/update.report.inc
Theme project status report.
theme_update_version in modules/update/update.report.inc
Theme the version display of a project.
theme_upload_attachments in modules/upload/upload.module
Displays file attachments in table
theme_username in includes/theme.inc
Format a username.
theme_user_admin_new_role in modules/user/user.admin.inc
Theme the new-role form.
tracker_page in modules/tracker/tracker.pages.inc
Menu callback. Prints a listing of active nodes on the site.
translation_node_overview in modules/translation/translation.pages.inc
Overview page for a node's translations.
trigger_assign_form in modules/trigger/trigger.admin.inc
Create the form definition for assigning an action to a hook-op combination.
user_admin_account in modules/user/user.admin.inc
Form builder; User administration page.
user_external_login_register in modules/user/user.module
Helper function for authentication modules. Either login in or registers the current user, based on username. Either way, the global $user object is populated based on $name.
user_login_block in modules/user/user.module
user_register_submit in modules/user/user.module
Submit handler for the user registration form.
user_update_7002 in modules/user/user.install
Convert user time zones from time zone offsets to time zone names.
XMLRPCValidator1IncTestCase::getInfo in modules/simpletest/tests/xmlrpc.test
_locale_translate_seek in includes/locale.inc
Perform a string search and display results in a table
_menu_overview_tree_form in modules/menu/menu.admin.inc
Recursive helper function for menu_overview_form().
_node_mass_update_batch_process in modules/node/node.admin.inc
Node Mass Update Batch operation
_openid_user_login_form_alter in modules/openid/openid.module
_statistics_link in modules/statistics/statistics.module
It is possible to adjust the width of columns generated by the statistics module.
_update_refresh in modules/update/update.fetch.inc
Fetch project info via XML from a central server.
_update_requirement_check in modules/update/update.module
Private helper method to fill in the requirements array.

Code

includes/common.inc, line 2114

<?php
function l($text, $path, array $options = array()) {
  global $language;

  // Merge in defaults.
  $options += array(
      'attributes' => array(),
      'html' => FALSE,
    );

  // Append active class.
  if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) && 
      (empty($options['language']) || $options['language']->language == $language->language)) {
    if (isset($options['attributes']['class'])) {
      $options['attributes']['class'] .= ' active';
    }
    else {
      $options['attributes']['class'] = 'active';
    }
  }

  // Remove all HTML and PHP tags from a tooltip. For best performance, we act only
  // if a quick strpos() pre-check gave a suspicion (because strip_tags() is expensive).
  if (isset($options['attributes']['title']) && strpos($options['attributes']['title'], '<') !== FALSE) {
    $options['attributes']['title'] = strip_tags($options['attributes']['title']);
  }

  return '<a href="' . check_plain(url($path, $options)) . '"' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain($text)) . '</a>';
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen