[drupal-devel] Improve Drupal themability
Stefan Nagtegaal
Drupal-Devel at iStyledThis.nl
Thu Apr 14 11:28:48 UTC 2005
All,
to improve theming of drupal I would like to introduce two new
functions, which are theme_list() and theme_list_item()..
function theme_list($items = array(), $id) {
if (isset($items)) {
$output .= '<ul id="'. $id .'">';
foreach ($items as $item) {
$output .= theme('list_item', $item);
}
$output .= '</ul>';
}
return $output;
}
function theme_list_item($item, $class = NULL) {
return '<li class="'. $class .'">'. $item .'</li>';
}
These two functions will help us, theme drupal. Every list is getting a
unique id like $module-$method. For example we get:
<ul id="book navigation">
<li class="leaf"><a href="#">...</a></li>
<li class="leaf"><a href="#">...</a></li>
<li class="leaf"><a href="#">...</a></li>
</ul>
With these two functions we can get all hardcoded lists (<ul><li>) out
of drupal..
At the end, a lot of theme function will be deprecated. you can think
about theme_status_messages(), theme_node_list().
Combining this with the modified theme_box()-approach of Ber Kessels
(http://drupal.org/node/15332) we can theme almost anything we want and
how we want, with less extraneous markup..
I would like to know what you guys think about this, and dicuss before
having some major patches hitting the patch queue..
Stefan.
More information about the drupal-devel
mailing list