Dear all,
does anyone know a module where I can this: Define a taxonomy in my own content type and define in Views to use the taxonomy value and use it as CSS class for the div
Thanks, Matthias
Take a look at . drupal.org/project/field_formatter_css_class and see if will meet your needs
Gregg Marshall, CPMR, CSP, CMC http://vendor-tech.com http://linkedin.com/in/greggmarshall
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Matthias Fechner Sent: Monday, March 24, 2014 1:07 AM To: support@drupal.org Subject: [support] Set CSS class as taxonomy field for content type
Dear all,
does anyone know a module where I can this: Define a taxonomy in my own content type and define in Views to use the taxonomy value and use it as CSS class for the div
Thanks, 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/ ]
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
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@arizona.edu http://tshummel.com
________________________________________ From: support-bounces@drupal.org [support-bounces@drupal.org] on behalf of Matthias Fechner [idefix@fechner.net] Sent: Monday, March 24, 2014 10:46 AM To: support@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/ ]
Am 24.03.14 21:13, schrieb Hummel, Tracey S - (thummel):
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>
in this way I can change the class of the field or the div the field is included. But the structure views generate is: <div view> <div content> <div row1> <div field1/> <div field2/> </div row> <div row2> ... </div row2> </div content> </div view>
If I use the overwrite css class, I can change the class of the field1. But I would like to change the class of row1, row2, etc. with the value from field1.
Is there a way to do this, without touching manually the .tpl files?
Gruß, Matthias