Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
28 Apr 2005 at 16:21 UTC
Updated:
21 Feb 2008 at 17:01 UTC
Jump to comment: Most recent file
The theme system is very inconsistent and not clean. In a steady stream of patches i'll try to make the theme system clean and let most of the theme functions behave the same..
One of the main goals is, that when writing themes in PHPTemplate for example, the way how things are being returned is different from theme function to theme function..
Let's try to unify this, so theming will be more efficient, simpler and more consistent..
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | cleaner_themable_help-20050430.patch | 4.88 KB | TDobes |
| #5 | phptemplate_drupal_get_help.patch | 816 bytes | Stefan Nagtegaal |
| #3 | cleaner_themable_help_0.patch | 1.99 KB | killes@www.drop.org |
| #1 | cleaner_themable_help.patch | 1.99 KB | Stefan Nagtegaal |
Comments
Comment #1
Stefan Nagtegaal commentedThe attached patch does:
- remove unused function theme_help() and theme_error();
- added a wrapper function drupal_get_help() inside common.inc (for consistency with drupal_get_title(), drupal_get_breadcrumb(), etc);
- reimplemented theme_help(), only this time for a more consistent way for themers;
This patch makes it easier to theme the page specific helptexts for drupal.
To change your PHP-based themes, you can do:
To change your PHP-Template based theme:
if ($help):print $help;endif;becomes a simple:
print $help;If this patch is accepted i'll try to make the functions for returning the local tasks and the status messages behave the same..
Overriding the
<div class="help">...</div>could be done through deifinig your owntheme_help()function in your theme or template.php file.Comment #2
dikini commented+1 from me
it makes help text themeable
it uses semantic markup, which is good practice, or as some say the Right Way
Comment #3
killes@www.drop.org commentedThe patch had DOS line endings and wouldn't apply.
I fully support this patch. +1
Comment #4
adrian commentedI completely +1 this.
Comment #5
Stefan Nagtegaal commentedBecause Adrian +1's this, his reward is a proper patch against PHPTemplate, sorry I forgot this one...
here it is, a really simple one liner which does the job...
Comment #6
walkah commentedlooks good to me. +1
Comment #7
chx commented+1.
Comment #8
Bèr Kessels commentedand another +1
Comment #9
dries commentedAny particular reason we can't do:
instead of the proposed:
Comment #10
TDobes commentedWhy do we need a drupal_get_help function at all? Why could the theme_help function not look like this:
This would be far more consistent with what we've done with status messages (theme_status_messages). It would also ask less of theme authors as they would only need
$output .= theme('help');instead of$output .= theme('help', drupal_get_help());.Comment #11
dries commentedIsn't it amazing that everyone nods '+1' without actually reviewing the code?
Comment #12
TDobes commentedI've attached a "counter-patch" using the code I suggested. It also includes patches to update the core themes, which were missing from the other patch.
I also fixed the call to theme('status_messages'), which was being called as the (non-themable) theme_status_messages.
Comment #13
dries commentedCommitted TDobes' latest version! Thanks.
Comment #14
Stefan Nagtegaal commentedWell, I added the wrapper
drupal_get_help()to get more inline with the rest of the theming function likedrupal_get_title()anddrupal_get_breadcrumb()..To get rid of the most PHP-logic inside the theme function itself, was also a decision to make the warapper function. That way it is just one call to the
drupal_get_help()function to get the help, without having to much attention to PHP at all..I still think that my code is a little better when we look at consistency and usability..
I set the status of this post to 'Patch' again because I would like to improve the theme system more, by eliminating most of the PHP code/logic out of the themable functions (by replacing the code in wrapper functions), and so this is e-mailed to the drupal developers list.
Comment #15
dries commentedFeel free to provide more patches. I'll review them when they hit the patch queue. Set the status back to 'patch' when there is a new patch to be reviewed.
Comment #16
coreb commentedMoving out of the x.y.z queue into 6.x-dev. Technically, the theme system has been improving with each version, so it is probably safe to close this, but I'd rather have others decide.
Comment #17
kkaefer commentedThis patch has already been comitted.
Comment #18
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.