Simplification of complex theme function #1 theme_status_messages.

Its one of the most heard complaints in the themeing corner of Drupal: that functions are faaar too complex. http://groups.drupal.org/node/716. And since I beleive the only workable way to achieve progression is to tackle the complex functions one a time: here is one.

This patch splits out theme_status_messages. And it uses a standard theme function to build a list: theme_item_list.

(patch made on a 4.7 system, but it applied correct to a HEAD)

Comments

Bèr Kessels’s picture

Status: Needs review » Needs work

hold the reviews. This is stupid: I copied the name of my theme in it. So it only works when testing on my theme :(. Ugh.

Bèr Kessels’s picture

Status: Needs work » Needs review
StatusFileSize
new1.63 KB

Sorry for the wrong patch above. This one is the correct one.

dries’s picture

Theme functions calling theme functions? Not sure about that.

Bèr Kessels’s picture

«Theme functions calling theme functions?» I really dislike that too. But ATM that is the case all over Drupal.

If we now and here choose this is no longer "allowed", I think we do a very good step towards a better abstracted theme layer. But that would mean a great lot of work too. I hope we can pull this discussion to another place and time (oscom, themes.drupal.org).

Can you give concrete examples what functions you dont want to be called? Is it theme(item_list)?

What I did here, is make this function simpler. Not improve our theme model :).

Bèr Kessels’s picture

Title: Simplification of thee_status_messages » Simplification of theme_status_messages
eaton’s picture

Hmmm. Why shouldn't theme functions call other theme functions? I've set up systems where an entire page might be themed, but the individual portions of it are split into their own thmee functiosn for easier granular overriding. It can be overdone, but I didn't realize it was something to be avoided in and of itself.

Bèr Kessels’s picture

Lets get the focus back on the patch: Dries, what do you like to see changed in this patch? Is it too complex? Do you dislike the fact I use theme_item_list to build the item-list? is it the fact that I split out the messages and the compilation of these messages into separate functions?

Bèr Kessels’s picture

FWIW: since I beleive Dries touched an important point about nesting theme functions, I opened a thread about this in the theme group: http://groups.drupal.org/node/1082

drumm’s picture

Version: x.y.z » 6.x-dev
Status: Needs review » Closed (duplicate)