diff --git a/core/includes/common.inc b/core/includes/common.inc index 540f42b..c37a012 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2369,12 +2369,25 @@ function l($text, $path, array $options = array()) { $use_theme = FALSE; } } - if ($use_theme) { - return theme('link', array('text' => $text, 'path' => $path, 'options' => $options)); - } + + $attributes = new Attribute($options['attributes']); + // There is no reason for url() to receive HTML attributes. + unset($options['attributes']); + // 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 '' . ($options['html'] ? $text : check_plain($text)) . ''; + $href = check_plain(url($path, $options)); + $title = $options['html'] ? $text : check_plain($text); + + if ($use_theme) { + return theme('link', array( + 'title' => $title, + 'href' => $href, + 'attributes' => $attributes + )); + } + + return '' . $title . ''; } /** diff --git a/core/includes/theme.inc b/core/includes/theme.inc index d2fe902..ae345d1 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1632,13 +1632,13 @@ function theme_status_messages($variables) { * or process functions or override this theme implementation. * * @param $variables - * An associative array containing the keys 'text', 'path', and 'options'. See - * the l() function for information about these variables. + * An associative array containing the keys 'content', 'href', 'options', + * and 'attributes'. See the l() function for information about $variables. * * @see l() */ function theme_link($variables) { - return '' . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) . ''; + return '' . $variables['content'] . ''; } /** @@ -2967,7 +2967,7 @@ function drupal_common_theme() { 'variables' => array('display' => NULL), ), 'link' => array( - 'variables' => array('text' => NULL, 'path' => NULL, 'options' => array()), + 'variables' => array('content' => NULL, 'href' => NULL, 'options' => array(), 'attributes' => array()), ), 'links' => array( 'variables' => array('links' => array(), 'attributes' => array('class' => array('links')), 'heading' => array()), diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index a54743a..00069dc 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -1,5 +1,6 @@ drupal_get_destination(), 'attributes' => array('title' => $toggle_text) + $variables['attributes'])); -} - -/** * Determines the current state of the toolbar drawer's visibility. * * @return @@ -251,10 +228,15 @@ function toolbar_view() { // Add an anchor to be able to toggle the visibility of the drawer. $build['toolbar_toggle'] = array( - '#theme' => 'toolbar_toggle', - '#collapsed' => _toolbar_is_collapsed(), - '#attributes' => array('class' => array('toggle')), + '#theme' => 'link__toolbar_toggle', + '#content' => _toolbar_is_collapsed() ? t('Show toolbar') : t('Hide toolbar'), + '#href' => 'toolbar/toggle', + '#options' => array('query' => drupal_get_destination()), + '#attributes' => new Attribute(array('class' => array('toggle'))), ); + if (_toolbar_is_collapsed()) { + $build['toolbar_toggle']['#attributes']['class'][] = 'toggle-active'; + } // Prepare the drawer links CSS classes. $toolbar_drawer_classes = array(