[support] Set CSS class as taxonomy field for content type

Hummel, Tracey S - (thummel) thummel at email.arizona.edu
Mon Mar 24 20:13:14 UTC 2014


You could add the taxonomy field to the view; under the taxonomy field's Rewrite Rules, select "Rewrite the output of this field".  Use replacement patterns to add the taxonomy term as a CSS class.  Something like;
<div class="[tax-term-replacement-pattern]">[title]</div>

Tracey

--------------------
Tracey Hummel
Web Application Developer
tracey at arizona.edu
http://tshummel.com

________________________________________
From: support-bounces at drupal.org [support-bounces at drupal.org] on behalf of Matthias Fechner [idefix at fechner.net]
Sent: Monday, March 24, 2014 10:46 AM
To: support at drupal.org
Subject: Re: [support] Set CSS class as taxonomy field for content type

Am 24.03.14 10:33, schrieb Gregg Marshall:
> Take a look at .      drupal.org/project/field_formatter_css_class and see
> if will meet your needs

I tried it but it seems not to work with views?

What I did is added a new taxonomy field to my self defined content-type.
Then I create with views a new block.
I added my taxonomy field and selected as formatter "CSS Class", as
Target tag "Field" and as Target Level "Standard" (I also tested it with
different settings for target and level).
I checked the "Remove original field from output".

Now I added my new block to the main page section and configured the
block to be only displayed on the <front> page.

If I display the front page, it is not working. Class is not added.


But if I open the node itself, the class is added.

But as I need it for views it seems not to be module I require.
Do you have another suggestion what module I could use?



Gruß,
Matthias

--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
--
[ Drupal support list | http://lists.drupal.org/ ]


More information about the support mailing list