I am having a problem rendering fields that have more than one value.
I have followed the taxonomy example in your video and used the same technique for outputting a list of image urls in Views. That works fine with a single comma delimited string but fails when trying to return anything more than a single value. Passing back an array causes failure. I was under the impression that services_raw format should return the entity but it returns nothing at all when more than a single value is present.
Values are present in the Views Preview mode e.g.
'image' =>
array (
0 =>
array (
'fid' => '38',
'alt' => '',
'title' => '',
'width' => '250',
'height' => '264',
'uid' => '1',
'filename' => 'me_side_sml.jpg',
'uri' => 'public://field/image/me_side_sml.jpg',
'filemime' => 'image/jpeg',
'filesize' => '59953',
'status' => '1',
'timestamp' => '1360073484',
'rdf_mapping' =>
array (
),
),
);
But in the actual content returned by services I get
image : ""
Have spent a bit of time looking at the code but still unsure how to fix this. Any ideas?
Comments
Comment #1
pau1_m commentedViews are handled differently depending on the resource being used.
Breaks Services Raw output whilst
Works totally fine.
Is this a bug or the intended behaviour?
Comment #2
pau1_m commentedIt was an absolute deal breaker for me not to be able to pass arguments to individual views resources so I wrote a small patch that allows it.
I realise this module works as designed but I'm posting just in case it helps someone out. Hopefully not too hacky.
Example
Comment #3
msakurada commentedSo I could do this without a patch using views in D7:
Add a "File Usage: File" relationship (Advanced->Relationsips)
Add a "File: Path" to the Fields Section. During the formatting of the field click on "Display download path instead of file storage URI".
You now get the URL in the top level view without having to traverse to the resource.
However your right about services raw for the view. It should be patched to test for image types and then do a
If I keep using the module for my use case I'll put out a patch.
Comment #4
ygerasimov commentedI think we can close this issue as there is solution.
Comment #6
Coyote commentedI'm a little confused - the original question in this thread was about services raw returning entities when there are multiple values, then the original poster posted a patch for sending arguments to views - which is nice, but the original problem still exists, and the issue has been marked as fixed. As near as I can tell, no fields with multiple values are able to be returned as raw - you end up with html output or completely blank output.
Comment #7
mcventur commentedSubscribing
Comment #7.0
mcventur commentedtypo
Comment #8
tanius commentedFor rendering fields that have more than one value (using the Views resource and only if your desired output format is JSON or XML), I have found a workaround solution and documented it at #678202-12: Views does not return taxonomy for Services.
Comment #9
fcedillo commentedthank you very much @pau1_m, for knowledge in #1 and patch in #2
Comment #10
prsnjtbarman commented#2 Works Fine