0

I need to remove a field for a view(Block) for a particular content type.

I have two different content types.One is Article and another is External News.

The following are the fields I added in the view.

Field:

      Content: Title
      Content: Post date
      Content: External URl
      Content: Last comment author
      Content: External URl

CONTEXTUAL FILTERS:
   Content: Has taxonomy term ID

FILTER CRITERIA
    Content: Published (Yes)  AND
    Content: Type (in Article, ...)
     AND
     Content: Has taxonomy terms (with depth) (= Technology)  AND | Settings
     Field: Tags 

Here I need the field Last Comment author to display only when the content type is Article and not for External news.

Can Anyone help me how to filter the field based on the content type for a view block

  • Right now the External news also displaying the last Comment author,but i don't want to display it to External news content type. – bharathi Mar 9 '12 at 10:06
1

You can use a preprocess hook to build in some logic to now show the last comment when the content type if of the type is External news. You need to add the content type and exclude it from display. That will make the value available in the preprocess hook.

You could use hook_preprocess_views_fields for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.