Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1011 diff -u -p -r1.1011 common.inc --- includes/common.inc 9 Oct 2009 16:33:13 -0000 1.1011 +++ includes/common.inc 10 Oct 2009 23:49:27 -0000 @@ -2567,6 +2567,37 @@ function drupal_attributes(array $attrib * an HTML string containing a link to the given path. */ function l($text, $path, array $options = array()) { + $variables = array( + 'text' => $text, + 'path' => $path, + 'options' => $options, + ); + // @todo: This is probably too cautious. What's the right condition for + // knowing if theme() is safe to call? There are test failures if all we + // do is check function_exists('theme'). + return (drupal_get_bootstrap_phase() != DRUPAL_BOOTSTRAP_FULL) ? theme('link', $variables) : theme_link($variables); +} + +/** + * Format an internal Drupal link. + * + * @param $variables + * A keyed array with 'text', 'path', and 'options'. + * @see l() for documentation about these. + * + * @return + * an HTML string containing a link to the given path. + * + * @ingroup themeable + * + * @todo + * If it's never possible for l() to be called without theme.inc loaded, + * then move this function to theme.inc. + */ +function theme_link($variables) { + $text = $variables['text']; + $path = $variables['path']; + $options = $variables['options']; global $language_url; // Merge in defaults. @@ -4846,6 +4877,9 @@ function drupal_common_theme() { 'status_messages' => array( 'arguments' => array('display' => NULL), ), + 'link' => array( + 'arguments' => array('text' => NULL, 'path' => NULL, 'options' => array()), + ), 'links' => array( 'arguments' => array('links' => NULL, 'attributes' => array('class' => array('links')), 'heading' => array()), ),