#78487 by FredCK, forngren and bjaspan: document <front> support in url() and l() and proper active class support for <front>
parent
fb3a1dd013
commit
dcf7a123dc
|
@ -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';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue