Closed (won't fix)
Project:
Views Datasource
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 May 2013 at 10:20 UTC
Updated:
22 Jul 2013 at 20:07 UTC
Hello,
we try to make a multi-level export in JSON, like this :
{
"timeline":
{
"type":"default",
"startDate":"2012,1,26",
"date": [
{
"startDate":"2011,12,12",
"endDate":"2012,1,27",
"headline":"Vine",
"text":"<p>Vine Test</p>",
"asset":
{
"media":"../source/gfx/interior.jpg",
"thumbnail":"../source/gfx/soleil.jpg"
}
},
{
"startDate":"2012,1,26",
"endDate":"2012,1,27",
"headline":"Exhibition",
"asset":
{
"media":"http://www.youtube.com/watch?v=6kRdjIFfJqk",
"credit":"some credits here"
}
}
]
}
}
but we dont know how to do it. is-it possible ? How can we configure that in the views fields ?
thank you for your help
Comments
Comment #1
sonoutlaw commentedI'm try to do the same for timeline.js . Don't want to use the timeline module, just want to be able to export the multi-level JSON file it requires as shown above in Matthieus' post.
Any ideas?
Comment #2
anthonylindsay commentedI could not see a way to do it with views_datasource.
I had to create a custom module to do it. I created a view that pulled in the NIDs of all the elements I wanted in my timeline, then called the view with views_get_view_result.
I set up the json preamble as a string down to the start of the array of events and then looped through my views data like this:
Adding to my json data string as needed and including the items from my nodes. Then I closed off the json and did drupal_add_js to call the timeline javascript files and added my json as a setting with
drupal_add_js(array('myModule' => array('timeline_data_object' => $json_data_object)), 'setting');Works a treat, but does involve a custom module.
Comment #3
anthonylindsay commentedClosing this as I don't think this type of multi level configuration is feasible within views_datasource, whilst keeping it generic and therefore useful.