l

Versions
mediamosa-21
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/content". 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"), 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.
  • language: An optional language object. If the path being linked to is internal to the site, $options['language'] is used to look up the alias for the URL, and to determine whether the link is "active", or pointing to the current page (the language as well as the path must match). If $options['language'] is omitted, the language defined by the current page's URL will be used; this depends on the site's language negotiation settings (sub-domain or URL prefix).

Return value

an HTML string containing a link to the given path.

▾ 165 functions call l()

actions_synchronize in includes/actions.inc
Synchronizes actions that are provided by modules in hook_action_info().
aggregator_aggregator_parse in modules/aggregator/aggregator.parser.inc
Implements 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_help in modules/block/block.module
Implements hook_help().
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
Implements hook_user_view().
blog_view in modules/blog/blog.module
Implements hook_view().
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.
coder_review_form_alter in sites/all/modules/coder/coder_review/coder_review.module
Implements hook_form_alter().
coder_upgrade_conversions_form in sites/all/modules/coder/coder_upgrade/coder_upgrade.module
Form builder for the module conversion form.
coder_upgrade_conversions_form_submit in sites/all/modules/coder/coder_upgrade/coder_upgrade.module
Submit handler for the module conversion form.
coder_upgrade_help in sites/all/modules/coder/coder_upgrade/coder_upgrade.help.inc
Implement hook_help().
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.
confirm_form in modules/system/system.module
Output a confirmation form
contact_category_edit_form_submit in modules/contact/contact.admin.inc
Process the contact category edit page form submission.
contact_category_list in modules/contact/contact.admin.inc
Categories/list tab.
dashboard_permission in modules/dashboard/dashboard.module
Implements hook_permission().
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.
devel_function_reference in sites/all/modules/devel/devel.module
Returns a list of all currently defined user functions in the current request lifecycle, with links their documentation.
devel_node_access_form_alter in sites/all/modules/devel/devel_node_access.module
devel_query_table in sites/all/modules/devel/devel.module
Adds a table at the bottom of the page cataloguing data on all the database queries that were made to generate the page.
devel_variable_form in sites/all/modules/devel/devel.module
dna_summary in sites/all/modules/devel/devel_node_access.module
drupal_pre_render_link in includes/common.inc
#pre_render callback to render a link into #markup.
field_help in modules/field/field.module
Implements hook_help().
field_ui_fields_list in modules/field_ui/field_ui.admin.inc
Menu callback; lists all defined fields for quick reference.
filter_permission in modules/filter/filter.module
Implements hook_permission().
forum_node_view in modules/forum/forum.module
Implements hook_node_view().
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.
hook_system_themes_page_alter in modules/system/system.api.php
Alters theme operation links.
hook_user_view in modules/user/user.api.php
The user's account information is being displayed.
hook_view in modules/node/node.api.php
Display a node.
locale_date_format_language_overview_page in modules/locale/locale.admin.inc
Display edit date format links for each language.
mediamosa_app_form in sites/all/modules/mediamosa/core/node/mediamosa_node_mediamosa_app.inc
Implements hook_form().
mediamosa_app_view in sites/all/modules/mediamosa/core/node/mediamosa_node_mediamosa_app.inc
Implements hook_view().
mediamosa_batch_jobs_log in sites/all/modules/mediamosa/modules/batch_jobs/mediamosa_batch_jobs.callbacks.inc
Callback function to display the contents of a log.
mediamosa_batch_jobs_parse_table in sites/all/modules/mediamosa/modules/batch_jobs/mediamosa_batch_jobs.helpers.inc
Parse the job table based on given type (queue or history).
mediamosa_browse_asset_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
Add+Edit form
mediamosa_browse_asset_list_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
Form builder; asset listing page.
mediamosa_browse_collection_list_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_collection.inc
Form builder; collection listing page.
mediamosa_development_rest_form in sites/all/modules/mediamosa_development/mediamosa_development.admin.inc
The form to execute a REST call.
mediamosa_integrity_check_page in sites/all/modules/mediamosa/modules/integrity_check/mediamosa_integrity_check.module
Integrity check page / list.
mediamosa_maintenance_browse_errorcode_edit_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_errorcode.inc
The edit form.
mediamosa_maintenance_browse_errorcode_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_errorcode.inc
The main browse form.
mediamosa_maintenance_browse_restcall_details in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_restcalls.inc
View specific details of a REST call.
mediamosa_maintenance_browse_restcall_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_restcalls.inc
The main browse form.
mediamosa_maintenance_browse_revision_form in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_revision.inc
Show listing of the revisions (of our nodes).
mediamosa_migration_form in sites/all/modules/mediamosa_migration/mediamosa_migration.admin.inc
mediamosa_server_form in sites/all/modules/mediamosa/core/node/mediamosa_node_mediamosa_server.inc
Implements hook_form().
mediamosa_server_view in sites/all/modules/mediamosa/core/node/mediamosa_node_mediamosa_server.inc
Implements hook_view().
mediamosa_transcode_profile_view in sites/all/modules/mediamosa/core/node/mediamosa_node_mediamosa_transcode_profile.inc
Implements hook_view().
mediamosa_webservice_form in sites/all/modules/mediamosa/modules/webservice/mediamosa_webservice.module
Webservice form.
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_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_page_default in modules/node/node.module
Menu callback; Generate a listing of promoted nodes.
node_requirements in modules/node/node.module
Implements hook_requirements().
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
Implements 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.
php_enable in modules/php/php.install
Implements hook_enable().
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
Implements 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.
seven_admin_block_content in themes/seven/template.php
Override of theme_admin_block_content().
seven_node_add_list in themes/seven/template.php
Display the list of available node types for node creation.
shortcut_set_admin in modules/shortcut/shortcut.admin.inc
Menu page callback: builds the page for administering shortcut sets.
shortcut_set_customize in modules/shortcut/shortcut.admin.inc
Form callback: builds the form for customizing shortcut sets.
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
syslog_form_system_logging_settings_alter in modules/syslog/syslog.module
Implements hook_form_FORM_ID_alter().
system_actions_manage in modules/system/system.admin.inc
Menu callback; Displays 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_date_time_formats in modules/system/system.admin.inc
Displays the date format strings overview page.
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_main_admin_page in modules/system/system.admin.inc
Menu callback; Provide the administration overview page.
system_requirements in modules/system/system.install
Test and report Drupal installation requirements.
system_token_info in modules/system/system.tokens.inc
Implements hook_token_info().
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_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_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_coder_review_warning in sites/all/modules/coder/coder_review/coder_review.module
Format a coder_review warning to be included in results.
theme_comment_block in modules/comment/comment.module
Returns a formatted list of recent comments to be displayed in the comment block.
theme_drupalapi in sites/all/modules/coder/coder_review/coder_review.module
Format link to Drupal API.
theme_file_link in modules/file/file.module
Output a link to a file.
theme_filter_tips_more_info in modules/filter/filter.module
Format a link to the more extensive filter tips.
theme_image_formatter in modules/image/image.field.inc
Theme function for image field formatters.
theme_image_style_list in modules/image/image.admin.inc
Display the page containing the list of image styles.
theme_image_style_preview in modules/image/image.admin.inc
Theme callback for displaying a preview of an image style.
theme_links in includes/theme.inc
Return a themed set of links.
theme_locale_languages_overview_form in modules/locale/locale.admin.inc
Theme the language overview form.
theme_mediamosa_maintenance_browse_properties in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse.inc
Our asset/collection detail view.
theme_menu_link in includes/menu.inc
Generate the HTML output for a menu link and submenu.
theme_menu_local_action in includes/menu.inc
Generate the HTML output for a single local action link.
theme_menu_local_task in includes/menu.inc
Generate the HTML output for a single local task link.
theme_node_add_list in modules/node/node.pages.inc
Display the list of available node types for node creation.
theme_node_recent_block in modules/node/node.module
Returns a formatted list of recent nodes.
theme_node_recent_content in modules/node/node.module
Returns a formatted recent node to be displayed in the recent content block.
theme_pager_link in includes/pager.inc
Format a link to a specific query result page.
theme_phpapi in sites/all/modules/coder/coder_review/coder_review.module
Format link to PHP documentation.
theme_system_compact_link in modules/system/system.module
Display the link to show or hide inline help descriptions.
theme_update_last_check in modules/update/update.module
Render the HTML to display the last time we checked for update data.
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_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
Returns the form for assigning an action to a trigger.
update_manager_update_form in modules/update/update.manager.inc
Build the form for the update manager page to update existing projects.
user_account_form in modules/user/user.module
Helper function to add default user account fields to user registration and edit form.
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.
_coder_review_7x_drupal_clone_warning in sites/all/modules/coder/coder_review/includes/coder_review_7x.inc
_coder_review_settings_form in sites/all/modules/coder/coder_review/coder_review.module
Build settings form API array for coder_review.
_locale_translate_seek in includes/locale.inc
Perform a string search and display results in a table
_mediamosa_app_contacts in sites/all/modules/mediamosa/modules/app/mediamosa_app.module
Show more specific information about a application.
_mediamosa_app_list in sites/all/modules/mediamosa/modules/app/mediamosa_app.module
Show a listing of apps.
_mediamosa_browse_asset_page_view in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
View the details of an asset.
_mediamosa_browse_asset_page_view_collections_list in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
Build the mediafile listing.
_mediamosa_browse_asset_page_view_job_list in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
Build the job list.
_mediamosa_browse_asset_page_view_mediafile_list in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_asset.inc
Build the mediafile listing.
_mediamosa_browse_collection_page_view in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_collection.inc
View the details of an collection.
_mediamosa_maintenance_status in sites/all/modules/mediamosa/maintenance/mediamosa_maintenance.module
Generate the status page.
_mediamosa_maintenance_view_revision in sites/all/modules/mediamosa/maintenance/browse/mediamosa_maintenance_browse_revision.inc
Show details of a revision.
_mediamosa_node_revision_overview in sites/all/modules/mediamosa/core/node/mediamosa_node.inc
Show the node revision information.
_mediamosa_server_list in sites/all/modules/mediamosa/modules/server/mediamosa_server.module
Show the mediamosa servers.
_mediamosa_transcode_profile_list in sites/all/modules/mediamosa/modules/transcode/profile/mediamosa_transcode_profile.inc
Show the listing of the current transcode profiles.
_mediamosa_webservice_list in sites/all/modules/mediamosa/modules/webservice/mediamosa_webservice.module
List of all webservices.
_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_requirement_check in modules/update/update.install
Private helper method to fill in the requirements array.

Code

includes/common.inc, line 2175

<?php
function l($text, $path, array $options = array()) {
  global $language_url;
  static $use_theme = NULL;

  // 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_url->language)) {
    $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']);
  }

  // Determine if rendering of the link is to be done with a theme function
  // or the inline default. Inline is faster, but if the theme system has been
  // loaded and a module or theme implements a preprocess or process function
  // or overrides the theme_link() function, then invoke theme(). Preliminary
  // benchmarks indicate that invoking theme() can slow down the l() function
  // by 20% or more, and that some of the link-heavy Drupal pages spend more
  // than 10% of the total page request time in the l() function.
  if (!isset($use_theme) && function_exists('theme')) {
    // Allow edge cases to prevent theme initialization and force inline link
    // rendering.
    if (variable_get('theme_link', TRUE)) {
      drupal_theme_initialize();
      $registry = theme_get_registry();
      // We don't want to duplicate functionality that's in theme(), so any
      // hint of a module or theme doing anything at all special with the 'link'
      // theme hook should simply result in theme() being called. This includes
      // the overriding of theme_link() with an alternate function or template,
      // the presence of preprocess or process functions, or the presence of
      // include files.
      $use_theme = !isset($registry['link']['function']) || ($registry['link']['function'] != 'theme_link');
      $use_theme = $use_theme || !empty($registry['link']['preprocess functions']) || !empty($registry['link']['process functions']) || !empty($registry['link']['includes']);
    }
    else {
      $use_theme = FALSE;
    }
  }
  if ($use_theme) {
    return theme('link', array('text' => $text, 'path' => $path, 'options' => $options));
  }
  // The result of url() is a plain-text URL. Because we are using it here
  // in an HTML argument context, we need to encode it properly.
  return '<a href="' . check_plain(url($path, $options)) . '"' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain($text)) . '</a>';
}
?>