#318636: make l() themable. From: damz --- common.inc | 25 ++++++++++++++++++++++++- simpletest/tests/common.test | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git includes/common.inc includes/common.inc index e82e8b2..33c0966 100644 --- includes/common.inc +++ includes/common.inc @@ -2605,7 +2605,27 @@ function l($text, $path, array $options = array()) { $options['attributes']['title'] = strip_tags($options['attributes']['title']); } - return '' . ($options['html'] ? $text : check_plain($text)) . ''; + $variables = array( + 'path' => check_plain(url($path, $options)), + 'attributes' => $options['attributes'], + 'text' => $options['html'] ? $text : check_plain($text), + ); + if (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) { + // Only call theme() if Drupal has been fully bootstrapped. + return theme('link', $variables); + } + else { + return theme_link($variables); + } +} + +/** + * Theme an internal Drupal link. + * + * @param $path + */ +function theme_link($variables) { + return '' . $variables['text'] . ''; } /** @@ -4915,6 +4935,9 @@ function drupal_common_theme() { 'indentation' => array( 'arguments' => array('size' => 1), ), + 'link' => array( + 'arguments' => array('path' => NULL, 'attributes' => array(), 'text' => NULL), + ), // from pager.inc 'pager' => array( 'arguments' => array('tags' => array(), 'element' => 0, 'parameters' => array(), 'quantity' => 9), diff --git modules/simpletest/tests/common.test modules/simpletest/tests/common.test index 3071af2..9b34386 100644 --- modules/simpletest/tests/common.test +++ modules/simpletest/tests/common.test @@ -4,7 +4,7 @@ /** * Tests for URL generation functions. */ -class CommonURLUnitTest extends DrupalUnitTestCase { +class CommonURLUnitTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'URL generation tests',