0

I have created a view which is displaying content type fields based on taxonomy term which is "Paid" and "Free".

I want to replace the text of content type field if the taxonomy term is "Paid" and I want to show different value for the content type field if it is "Free".

Is there a way to views alter by adding custom code.

I am just looking if this can be done in the views itself without using custom code.

Devraj
  • 294
  • 4
  • 14
sAnS
  • 1,169
  • 1
  • 7
  • 10

2 Answers2

0

If i am right you want to create a Filter in Views to show what content to show on value Paid and Free . For this you can do

  1. First create a Content with select option values as "Paid' and "Free" and mentioned text for Paid and Free as well.

  2. Now create a View and put Content type as a filter in it in which you can choose value Paid or Free , now moment user select any value its get displayed as per the value.

iNoob
  • 3,364
  • 2
  • 26
  • 33
Devraj
  • 294
  • 4
  • 14
  • hi the view will not be exposed to user and the condition should work inside the view itself without any hook. – sAnS Apr 22 '14 at 06:58
0

You should have a look at Views PHP. With this module you could add a PHP field to your view and test the value Paid or Free to display what you want.

But as the module page says :

While this module allows you to directly use PHP inside views which may be useful for quick and easy solutions, it is highly advisable to use regular handlers and plugins when available (or even to create one yourself).

Depending on your needs, you should consider writing a custom module or maybe rethink your implementation.

cedric_a
  • 1
  • 1
  • hi i know we can do this using custom module but i was just looking if this can be done inside the views itself.Regarding views php i know about this module but anyway thx for the info. – sAnS Apr 22 '14 at 07:27
  • This part of your question is not very clear for me : Is there a way to views alter **by adding custom code**. I am just looking if this can be done in the views itself **without using custom code**. – cedric_a Apr 22 '14 at 08:51
  • FYI the question is modified by someone without my approval .In the original question i haven't asked for custom code.. – sAnS Apr 22 '14 at 08:56
  • Ok, understood, the first sentence is not a question, it's "there is" – cedric_a Apr 22 '14 at 08:58