0

I've views formatted as table with a pager of 10 items pr page, in which I've a field called type, depending on that type, I need to modify the other field, show text.

I've tried using PHP global field, but when I put that it is not showing the checkboxes from the second page.

I've tried hook_views_pre_render, but did'nt see any good example to change the field.

0

You could try using Views Conditional

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.

As per the readme.txt

How to use Views Conditional:

  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.

| improve this answer | |
  • Can we do it programmatically using any hooks? – Fazeela Abu Zohra Apr 20 '18 at 7:31
  • I've done it in D7, in D8 not yet, but I bet you can. Tho, I am too lazy right now to look into it. – No Sssweat Apr 20 '18 at 7:33
  • @FazeelaAbuZohra you could create a template file views-view-fields--[view-name].html.twig template file and do it there too. – No Sssweat Apr 20 '18 at 7:34
  • I've done that and failed. – Fazeela Abu Zohra Apr 20 '18 at 7:35
  • @FazeelaAbuZohra post your template code, if you still have it. – No Sssweat Apr 20 '18 at 7:39

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.