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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Crell’s picture

Version: 4.6.5 » x.y.z

Reassigning 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" :-) )

Crell’s picture

Version: x.y.z » 6.x-dev

Or maybe not so shortly. Is this still an issue?

fax8’s picture

Assigned: Unassigned » fax8
Status: Active » Needs work
FileSize
475 bytes

Yes.. 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.

fax8’s picture

Title: make each forum container css themeable » make each forums container, forum table and forum css themeable
Status: Needs work » Needs review
FileSize
1.35 KB

The attached patch make containers, forum and forum listing tables css themable.

Steven’s picture

You should not use classes for things which are known to be unique.

bdragon’s picture

Status: Needs review » Needs work
Gurpartap Singh’s picture

Title: make each forums container, forum table and forum css themeable » Unique CSS IDs for forums, containers & forum table
Status: Needs work » Needs review
FileSize
1.59 KB

This patch makes them IDs.

Gurpartap Singh’s picture

Assigned: fax8 » Gurpartap Singh
FileSize
1.43 KB

This 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.

merlinofchaos’s picture

Status: Needs review » Reviewed & tested by the community

+1. I think this should go in. Adding a unique ID to the containers increases the power of the themer for very little cost.

dvessel’s picture

Status: Reviewed & tested by the community » Needs work

Actually, topic id "$tid" is available in both forum-topic-list.tpl.php and forum-list.tpl.php. Why not apply it to both?

dvessel’s picture

Status: Needs work » Needs review
FileSize
2.45 KB

Looking 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.

dvessel’s picture

Assigned: Gurpartap Singh » dvessel
Priority: Minor » Normal

Is this good or not? Looks RTBC in my opinion. :)

dvessel’s picture

FileSize
2.46 KB

re-reolled..

dmitrig01’s picture

Status: Needs review » Reviewed & tested by the community

Great feature

Wim Leers’s picture

+1

This greatly simplifies the theming of a specific forum.

Dries’s picture

Status: Reviewed & tested by the community » Needs work

I'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:

- $tid: Taxonomy term ID for the current forum. Parent to all items within
+ *   the $forums array.

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.

dvessel’s picture

Status: Needs work » Needs review
FileSize
3.59 KB

Okay Dries, your right. I always miss these things. :-)

Wim Leers’s picture

Patch 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.

dvessel’s picture

FileSize
3.44 KB

Yeah, not sure why I did that. here it is removed.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

RTBC

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Did you mean forum_id instead if tid? In the template.

dvessel’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
3.45 KB

Darnit! I needs glasses.

Wim Leers’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
3.51 KB

Oops. I missed that.

I'm also unsetting $variables['tid'], to prevent confusion about what that could be.

dvessel’s picture

Status: Needs review » Reviewed & tested by the community

That works too. :)

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Great, I see Dries only asked for this clarification in the variable name and docs, and otherwise he was fine with the patch, so committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)