I have a view that is showing all my content types. What I want is to hide a certain field in its row if the content type on this particular views row has a content type of Article.
How can I do that?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
One of solutions is using Views Conditional module
Views Conditional is a simple module that allows you to define conditionals (if xxx then yyy) with fields in views. Conditions include:
Equal To Not Equal To Greater Than Less Than Empty Not Empty
Views conditional allows you to output text based on the result of the condition.
How to use Views Conditional in your Views: 1. Create a view. Add some fields under "FIELDS". 2. Click on "ADD" next to fields. Scroll down to "Views: Views Conditional", probably found near the bottom of the list. 3. Add and configure fields... 4. Choose a field to run a condition against, and provide values accordingly. 5. Save, views conditional handles the logic and returns as specified.
For findout how it work at Views Conditional Module (Drupal 7 Tutorial) - YouTube
Add content type as a hidden field above the field you wish to hide. For the field you wish to hide rewrite the field so as to add a class, using the token for the hidden field (ie [hidden-[type] ), then target that via CSS (ie target hidden-article)