summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-11-04 21:24:09 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-11-04 21:24:09 +0000
commitdcf7a123dcdb6e72fc4107dd887332cff88578fa (patch)
tree68082fcd3b4bc378e44b85154b63444738bb538b /includes
parentfb3a1dd0134d2ddbbb62163c3c87d6370bd90272 (diff)
downloadbrdo-dcf7a123dcdb6e72fc4107dd887332cff88578fa.tar.gz
brdo-dcf7a123dcdb6e72fc4107dd887332cff88578fa.tar.bz2
#78487 by FredCK, forngren and bjaspan: document <front> support in url() and l() and proper active class support for <front>
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 1850e96e1..a60598f97 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
+ * '<front>' 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 '<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.
* @param $options
@@ -1388,7 +1391,7 @@ function l($text, $path, $options = array()) {
);
// Append active class.
- if ($path == $_GET['q']) {
+ if ($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) {
if (isset($options['attributes']['class'])) {
$options['attributes']['class'] .= ' active';
}