[drupal-devel] [task] improve theme system

stefan nagtegaal drupal-devel at drupal.org
Thu Apr 28 16:41:02 UTC 2005


Issue status update for http://drupal.org/node/21517

 Project:      Drupal
 Version:      cvs
 Component:    theme system
 Category:     tasks
 Priority:     normal
 Assigned to:  stefan nagtegaal
 Reported by:  stefan nagtegaal
 Updated by:   stefan nagtegaal
-Status:       active
+Status:       patch
 Attachment:   http://drupal.org/files/issues/cleaner_themable_help.patch (1.99 KB)

The 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:

<?php
-  if ($help = menu_get_active_help()) {
-    $output .= '<small>'. $help .'</small><hr />';
-  }
+  $output .= theme('help', drupal_get_help());
?>




To change your PHP-Template based theme:

<?php
 if ($help): 
?>


<?php
 print $help; 
?>


<?php
 endif; 
?>




becomes a simple:

<?php
 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 own theme_help() function in your theme or template.php
file.




stefan nagtegaal



Previous comments:
------------------------------------------------------------------------

April 28, 2005 - 18:21 : stefan nagtegaal

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..







More information about the drupal-devel mailing list