Make l() themable

Xano - October 8, 2008 - 17:36
Project:Drupal
Version:7.x-dev
Component:base system
Category:feature request
Priority:normal
Assigned:Xano
Status:needs work
Description

This patch creates theme_l() that can be overriden by themes. The original l() stays, because it is used for 'administrative' actions. The patch doesn't work yet, since for some reason theme('l'); doesn't actually call theme_l(). I need to look into this problem a little closer, but perhaps somebody can give me a nudge in the right direction.

AttachmentSize
theme_l_00.patch1.48 KB
Testbed results
theme_l_00.patchfailedFailed: 6715 passes, 212 fails, 29 exceptions Detailed results

#1

Damien Tournoud - October 8, 2008 - 20:40

Well, it makes sense and is a step toward a non-HTML output for Drupal. You will have to register 'theme_l' in a hook_theme().

#2

Xano - October 8, 2008 - 21:27

I thought so too, but in what hook_theme() implementation? I cannot find where the theme functions inside theme.inc are registered.

#3

Rob Loach - October 8, 2008 - 23:58

Although I'd keep l() the same, I'd rather use theme_link to go along with the naming of theme_links.

I'd also rather pass in the straight $attributes array instead of the HTML for the attributes from drupal_attributes.

#4

keith.smith - October 8, 2008 - 22:20

What's yaman about?

+function theme_l($path, $attributes, $text) {return '<strong>yaman</strong>';
+  return '<a href="' . $path . '"' . $attributes . '>' . $text . '</a>';
+}

Debugging code?

#5

Xano - October 9, 2008 - 07:58

Err, yes, that was debugging code. Must have overlooked it for some reason :S

#6

Xano - October 9, 2008 - 09:10
Status:needs work» needs review
  • This patch works. I registered theme_link() in drupal_common_theme().
  • Renamed theme_l() to theme_link().
  • Passed on attributes as an array.
  • Removed debugging code.
AttachmentSize
theme_l_01.patch 1.88 KB
Testbed results
theme_l_01.patchfailedFailed: Failed to apply patch. Detailed results

#7

Anonymous (not verified) - November 12, 2008 - 10:50
Status:needs review» needs work

The last submitted patch failed testing.

#8

Xano - November 15, 2008 - 19:14

According to swentel This patch still applies without problem. We both cannot figure out why the PHP filter tests failed. Could somebody please a look at this problem?

#9

maartenvg - November 16, 2008 - 21:31

I've looked at it and identified the l() in the following line in php.install as the bad guy:

<?php
drupal_set_message
(t('A %php-code input format has been created.', array('%php-code' => l('PHP code', 'admin/settings/filters/' . $format))));
?>

If the l() is replaced/removed, the all PHP Filter tests run without fails.

Seeing that only the simpletest environment and not the drupal installation itself shows any errors, leads me to think that the problem lies not with the patch, but within Simpletest. How and why, I am not sure, but I believe it has something to do with the cache/theme registry, because a single PHP.test case runs fine directly after clearing the cache.

#10

Xano - January 26, 2009 - 20:48
Status:needs work» needs review

Requesting re-test.

#11

Xano - January 26, 2009 - 21:40

Patch passes. I'd like to see some more reviews! :D

#12

System Message - February 1, 2009 - 15:05
Status:needs review» needs work

The last submitted patch failed testing.

#13

Xano - February 1, 2009 - 15:13

Requesting re-test. Testing server only says the tests failed, but all tests look OK.

#14

Xano - February 1, 2009 - 15:13
Status:needs work» needs review

Requesting re-test. Testing server only says the tests failed, but all tests look OK.

#15

System Message - February 1, 2009 - 15:30
Status:needs review» needs work

The last submitted patch failed testing.

#16

Xano - February 18, 2009 - 01:21
Status:needs work» needs review

Come on, testing bot. Convince me.

#17

System Message - February 20, 2009 - 18:25
Status:needs review» needs work

The last submitted patch failed testing.

 
 

Drupal is a registered trademark of Dries Buytaert.