Closed (fixed)
Project:
Services Views
Version:
7.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Jun 2012 at 08:49 UTC
Updated:
9 Mar 2013 at 10:05 UTC
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
Comment #1
ygerasimov commentedServices 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.
Comment #2
iadefy commentedNoted. Thanks.
How about the Content: Path field? Is that certain fields that services views will not showing any output?
Comment #3
ygerasimov commentedYes. 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);Comment #4
iadefy commentedWhere 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...
Comment #5
ygerasimov commentedAs 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.
Comment #6
iadefy commentedI'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.
Comment #8
windmaomao commentedit 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.
Comment #9
mototribe commentedthanks! That fixed it for me.
I had to add
in the values field of the PHP field. Also, the label had to be lowercase otherwise it wouldn't pick it up.
Comment #10
dippers commentedThe patch 2b in #1917032: Search API with Services Views will fix the original problem of not being able to rewrite nid field.
Comment #11
Jaesin commentedWhy 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.
Comment #12
dippers commented@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.