Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I propose to change line 891 in function theme_forum_list
$rows[] = array(array('data' => $description, 'class' => 'container', 'colspan' => '4'));
to
$rows[] = array(array('data' => $description, 'class' => 'container container-' . $forum->tid, 'colspan' => '4'));
This will let themers to theme each different forum container differently.
Note that this is possible overriding default theme function and writing a phpthemplate theme.
But a solution of this type is similar to what is already available for blocks. And it is smart.
Fabio
Comment | File | Size | Author |
---|---|---|---|
#23 | forum_unique_ids_1e_0.patch | 3.51 KB | Wim Leers |
#22 | forum_unique_ids_1e.patch | 3.45 KB | dvessel |
#19 | forum_unique_ids_1d.patch | 3.44 KB | dvessel |
#17 | forum_unique_ids_1c.patch | 3.59 KB | dvessel |
#13 | forum_unique_ids_1b.patch | 2.46 KB | dvessel |
Comments
Comment #1
Crell CreditAttribution: Crell commentedReassigning this to cvs, since 4.6.x doesn't get new features.
That said, it sounds like a good addition once the feature-freeze for 4.7 ends. (Meaning "someone will be with you shortly" :-) )
Comment #2
Crell CreditAttribution: Crell commentedOr maybe not so shortly. Is this still an issue?
Comment #3
fax8 CreditAttribution: fax8 commentedYes.. the code is not changed.. and I think this feature is still useful.
The attached patch add the code I described in my first post.
This will make possible to associate different css rules to each forum container
on the forum listing page.
Please note that this patch only make it possible to style forum containers,
not forums on the forum listing page. It could be also useful adding a similar feature
for also forums.
A similar approach could be useful also on the topic listing page.
Comment #4
fax8 CreditAttribution: fax8 commentedThe attached patch make containers, forum and forum listing tables css themable.
Comment #5
Steven CreditAttribution: Steven commentedYou should not use classes for things which are known to be unique.
Comment #6
bdragon CreditAttribution: bdragon commentedComment #7
Gurpartap Singh CreditAttribution: Gurpartap Singh commentedThis patch makes them IDs.
Comment #8
Gurpartap Singh CreditAttribution: Gurpartap Singh commentedThis one for new forum template files. Doesn't add id to table, as term id for it is unknown. Don't want to dig much into template variables.
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commented+1. I think this should go in. Adding a unique ID to the containers increases the power of the themer for very little cost.
Comment #10
dvessel CreditAttribution: dvessel commentedActually, topic id "$tid" is available in both forum-topic-list.tpl.php and forum-list.tpl.php. Why not apply it to both?
Comment #11
dvessel CreditAttribution: dvessel commentedLooking at this again, the $tid was clashing with the existing $tid variable. $tid is already supplied and it can be applied to the whole table.
Here it is again with an id added to the table and each *row*. Working off cells is less flexible.
forum-topic-list.tpl.php contains an id of "forum-topic-*" for the table.
forum-topic.tpl.php caintains "forum-*" for the whole table and "forum-list-*" for each table row.
Latest HEAD had some changes since yesterday.
Comment #12
dvessel CreditAttribution: dvessel commentedIs this good or not? Looks RTBC in my opinion. :)
Comment #13
dvessel CreditAttribution: dvessel commentedre-reolled..
Comment #14
dmitrig01 CreditAttribution: dmitrig01 commentedGreat feature
Comment #15
Wim Leers+1
This greatly simplifies the theming of a specific forum.
Comment #16
Dries CreditAttribution: Dries commentedI'm OK with this patch, but I was wondering what $cid stands for. Do we use $cid because $tid is taken?
Also, I'm not sure the PHPdoc is accessible for non-developers:
To understand this, you need to understand how the forum module is implemented, and how it leverages the taxonomy system. It think we can make this more accessible for designers by explaining this differently. Let's explain this in "forum terms" rather than "taxonomy terms", so to speak.
Otherwise this patch looks like something that we'll want to commit.
Comment #17
dvessel CreditAttribution: dvessel commentedOkay Dries, your right. I always miss these things. :-)
Comment #18
Wim LeersPatch works as advertised.
Small detail: is it by purpose that "id" is capitalized in .tpl.php files and is lowercase elsewhere? If yes, then this is RTBC.
Comment #19
dvessel CreditAttribution: dvessel commentedYeah, not sure why I did that. here it is removed.
Comment #20
Wim LeersRTBC
Comment #21
Gábor HojtsyDid you mean forum_id instead if tid? In the template.
Comment #22
dvessel CreditAttribution: dvessel commentedDarnit! I needs glasses.
Comment #23
Wim LeersOops. I missed that.
I'm also unsetting $variables['tid'], to prevent confusion about what that could be.
Comment #24
dvessel CreditAttribution: dvessel commentedThat works too. :)
Comment #25
Gábor HojtsyGreat, I see Dries only asked for this clarification in the variable name and docs, and otherwise he was fine with the patch, so committed.
Comment #26
(not verified) CreditAttribution: commented