User login

Theming tips for module developers session by John Albin Walker at DCSF2010

Reuse a theme hook if you can!

links
image
image_style
item_list
username
file_link
html_tag
more_link
pager
progress_bar
table

See full list:
http://api.drupal.org/api/group/themeable/7

Advantages of re-using:

  • Avoiding creating your own (addition to) hook_theme(), template or theme function, or template_preprocess_hook
    just: theme('hook', $vars);
  • John just made sure all of Drupal (i started my own clap, i have to learn to start earlier and keep it going long enough, but some people joined, John thanked us)

  • Themers don't have to learn how to theme just your module.
  • Instant integration with other modules. He re-used Drupal's core menu theming for menu block module. As a result, DHTML Menu workes with it great!

Theme hook suggestions

Looks for theme_links__node before falling back to theme_links

Awesome!

This gets over the problem of overriding all theme_links or theme_item_list when you really want to do it for one spot.

Searched words: 
john albin drupal theme hooks

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.