From dcf7a123dcdb6e72fc4107dd887332cff88578fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Sun, 4 Nov 2007 21:24:09 +0000 Subject: [PATCH] #78487 by FredCK, forngren and bjaspan: document support in url() and l() and proper active class support for --- includes/common.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 1850e96e1c6..a60598f9702 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1197,7 +1197,8 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL * * @param $path * The Drupal path being linked to, such as "admin/content/node", or an - * existing URL like "http://drupal.org/". + * existing URL like "http://drupal.org/". The special path + * '' may also be given and will generate the site's base URL. * @param $options * An associative array of additional options, with the following keys: * 'query' @@ -1355,6 +1356,8 @@ function drupal_attributes($attributes = array()) { * - 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 '', 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. * @param $options @@ -1388,7 +1391,7 @@ function l($text, $path, $options = array()) { ); // Append active class. - if ($path == $_GET['q']) { + if ($path == $_GET['q'] || ($path == '' && drupal_is_front_page())) { if (isset($options['attributes']['class'])) { $options['attributes']['class'] .= ' active'; }