The tracker2 tracker2_page() function combines the retrieval of nodes with the display of nodes. Further, since the display runs through the system-default theme functions for a table, there is very little control over the presentation of the tracker2_page, unless the site admin is willing to modify the display of *all* tables on the site.
My patch modifies the tracker2_page() function by splitting it up, so that the retrieval and presentation parts of the logic are separate. This facilitates code reuse, rather than having to copy/past the tracker2_page() function into whatever custom logic one is working on, and modifying that.
tracker2_page() //assembles nodes list, and adds new comment info
tracker2_get_nodes_for_user() //gets the "raw" node list
theme_tracker2_page() // implements theming so site designers can customize the display.
Also, my patch includes a minor bug fix. In version 1.x-1.12, line 369, we see:
else {
$rows[] = array(array('data' => t('No posts available.'), 'colspan' => '5'));
}
Notice: The array $rows has not been defined yet for this branch of the logic.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | themeable_tracker2_module_v1_1.patch | 4.09 KB | apotek |
| themeable_tracker2_module_v1.patch | 4.06 KB | apotek |
Comments
Comment #1
apotek commentedNote: I realized my patch might not be able to be applied directly, since I had added a few other comments to the tracker2.module. I'll see if I can re-roll with unmodified version 1.13 instead.
Comment #2
apotek commentedAttaching a (hopefully) better patch.
Comment #3
apotek commentedSince posting the patch, I realized in changing the code around I left the $rows = array() declaration in the wrong place.
It should be removed from tracker2_page():
and added to theme_tracker2_page():
Comment #4
david straussCan you reroll this patch with the latest comment's changes integrated?