In privatemsg.module the _privatemsg_list_thread() function has this documentation:

/**
 * Formats a row in the message list.
 *
 * Does use theme patterns to display the single fields.
 * 
 * @param $thread
 *   Array with the row data returned by the database.
 * @return
 *   Row definition for use with theme('table')
 */

This:

* Does use theme patterns to display the single fields.

Should probably read:

* Uses patterns to theme single fields according to their type.

Assuming I have interpreted what theme patterns are for correctly. :)

Comments

liam mcdermott’s picture

Am also curious about this line:

      // The default theme returns nothing, only store the value if we have something.

It doesn't return anything, why?

berdir’s picture

Hm. I'm not a native speaker, but your suggestion doesn't make sense to me. "theme pattern" imho belongs together, it's a feature that the theme system provides.

A "theme pattern" is simply a wildcard for theme names. By defining "'pattern' => 'privatemsg_list_header__',", the theme system will search for functions that start with that name (and with the theme name prefix). We can then pass an array with multiple possible names to theme() which will use the first match it can find. That's basically everything these patterns do.

I will handle the documentation of those that in a separate topic in the apidocs.

liam mcdermott’s picture

Fair enough, the problem with the existing docs are 'Does use' should be 'Uses' and 'display the single fields' should be 'display single fields'. :)

So, how about:

* Uses theme patterns to theme single fields.

I understand how theme patterns work. What I don't understand is what problem they solve. If we can explain -- in the docs -- the problem we're solving, and how theme patterns solve that problem, it becomes obvious why the code is the way it is.

liam mcdermott’s picture

Component: Code » Documentation
Status: Active » Needs review
StatusFileSize
new681 bytes

And here's a patch.

litwol’s picture

Commited the patch from #4 as is. however it is not immediately clera what are those evil patterns. To help whomever is reading this line of code find more information we should include some further reading link. Not sure if @see is able to point to files which documents this well (privatemsg.theme.inc), if not then we can just point the reader to documentation on d.o if such exists.

berdir’s picture

StatusFileSize
new1.07 KB
litwol’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)
Issue tags: -348907

Automatically closed -- issue fixed for 2 weeks with no activity.