Hi,

I've tried on both beta2 & dev version, both have the same issue that I'm having.

I tried to rewrite the output of nid field, but the result is always showing the nid. I added the Content: Path to the field, and the output simply ignore it under the Services View. It did show up properly in Master & Page view though...

Thanks,

Comments

ygerasimov’s picture

Category: bug » support
Status: Active » Fixed

Services views do not execute complete theming in views so overwriting output will simply not work.

Please create custom PHP field and perform your custom output there.

iadefy’s picture

Noted. Thanks.

How about the Content: Path field? Is that certain fields that services views will not showing any output?

ygerasimov’s picture

Yes. I believe path won't be displayed properly by services_views as well. But again it is easy to emulate it with custom PHP code:
url('node/' . $nid);

iadefy’s picture

Where should I put the custom php field? I added the Global: PHP field to the services views, and there is no output from services_view for the Global: PHP field...

ygerasimov’s picture

As example please take a look my screencast http://www.youtube.com/watch?v=DZEhJKMeR5w&feature=youtu.be

On 5:34 there is example of the using PHP field.

The idea is that you first add nid field (might be hidden). Then you add your PHP field and have access to nid as $row->nid.

iadefy’s picture

I've watched the video, I added the PHP field but it still didn't show up in the "Service" view, it did show up in the Master/Page view though.

I did a search and found that this thread: http://drupal.org/node/1435146 was reporting the same issue (except it's for D6), I did the output of single variable (as suggested) and also return the json output of the value but got nothing in service views as well.

Status: Fixed » Closed (fixed)

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

windmaomao’s picture

it does work, the thing is where we should put code,

currently it's looking for "return " in value code section, i guess people are expecting to use output from output code section.

mototribe’s picture

thanks! That fixed it for me.
I had to add

 return url('node/' . $row->nid); 

in the values field of the PHP field. Also, the label had to be lowercase otherwise it wouldn't pick it up.

dippers’s picture

The patch 2b in #1917032: Search API with Services Views will fix the original problem of not being able to rewrite nid field.

Jaesin’s picture

Why doesn't services_views support theming and rewriting?

Was it an architectural decision or does it just need to be implemented?

Not everyone can use vews_php. Some clients don't allow it on their site.

dippers’s picture

@Jaesin the patch in #1917032: Search API with Services Views will allow rewriting. I'm not sure what you mean by theming as this is generally for html output.