Hi, is there a way I can provide a custom action for all text type fields? I'd like to add in an action which runs the fields value through some string functions much like "trim whitespace". I can't find anything on others attempting this and it doesn't seem clear cut from the code as the rewrite stuff lives in the fairly low level field handler class. Thanks!

Comments

saurabh.dhariwal’s picture

You can achieve this by using your views.tpl.php file. from your view's "Advanced >> Other >> Theme"

i.e.

In your view settings, you can find Theme: Information in group Advanced and you have to add Content: Type in your Fields group.

In your views-view-fields--xxx--xxx.tpl.php file write something like:

if ($fields['type']->content == 'Page') {
  // print title linking to node
  print $fields['title']->content;
}

Thanks!

RenatoG’s picture

Status: Active » Reviewed & tested by the community

Hi guys, how are you? Good morning.

I tested the example in #1 of @saurabh.dhariwal and really works good.

RenatoG’s picture

Status: Reviewed & tested by the community » Fixed

@heylookalive, you can use this example for it.

You can use tpl for it.

Any question you can comment here for us okay?

Thank you very much @saurabh.dhariwal for your contribution.

Good Work.

Regards.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.