The documentation of the pattern argument does not really make any sense to me.

What I was looking for was this:
How do I actually do something like this in hook_theme (in pseudo-code):

'tmplfamily_[specialization]' = array(
'template' => 'tmplfamily_[specialization]',
...
}

where this should apply automatically to all theme('tmplfamily_[specialization]', $args)
such as
theme('tmplfamily_example1', $args);

which should then invoke tmplfamily_example1.tpl.php

I can't make it work from the documentation, and can't even decide whether 'pattern' would help there or not. The documentation is at least missing a complete working example.

Comments

asgalon’s picture

Title: Documentation problem with Reply to comment » Documentation problem with hook_theme
Anonymous’s picture

Title: Documentation problem with hook_theme » Better document the array key 'pattern_' used by hook_theme()

The description given for that array key should be expanded, as it is not clear how it is possible to use dynamic names for themes.
The description reports an example of call to the theme() function, but it's not clear to me where such call should be used.

Anonymous’s picture

Title: Better document the array key 'pattern_' used by hook_theme() » Better document the array key 'pattern' used from hook_theme()
jhodgdon’s picture

Version: 6.x-dev » 7.x-dev

Good idea to document this better and better yet, give an example in the hook's function body.

It should be documented in Drupal 7 first, and then backported to Drupal 6.

Anonymous’s picture

On http://drupal.org/update/modules/6/7#theme_hook_suggestions_1 there is example code for Drupal 6, and Drupal 7.

jhodgdon’s picture

Status: Active » Closed (works as designed)

This was updated on another issue.