Summary
- Currently views_datasource does not allow users to nest the attributes of the JSON created by this module.
- When the business requires more complex data structures, which is often the case, developers must resort to use another Drupal module, or create their own…
- I'd like to incorporate into views_datasource the capability to modify the (currently flat) JSON structure.
Background
I've opened this issue to gather ideas from fellow views_datasource maintainers, users, and the larger Drupal community as well. If you know of an existing module that performs this, you should link it here to see what ideas we can gather from their code. If you have any recommendations as to how we should approach the development of this feature, please feel free to let us know your ideas. The patterns explored in this issue would be ideally applied to the other formats as well.
Task list
- Build a small (separate) module in my local just to understand how drupal_add_tabledrag works along with the Form API (in progress).
- Investigate how to integrate tabledrag with Views.Tabledrag is already used. We should try hook_form_alter(ing) the Rearrange fields modal form, there we can change the parameters of the existing tabledrag to support nesting. We can also add our own submit handler and inspect the inner workings of the existing one.
- Figure out optimal way to store data.See chat log excerpt below.
UPDATE:
Yesterday (May 7, 2012) I was able to ask some of my questions to merlinofchaos via #drupal-contribute, which he kindly answered. Here's an excerpt from the chat logs:
[9:10pm] Don_Ricardo: Is there one place where would you recommend ppl to go and look how those fields are stored?
merlinofchaos: Everything ends up as options on the display object; each field/filter/everyotherplugin has its options fed in from that, and it goes through an unpack process so that the object gets the right data.
[9:12pm] merlinofchaos: There's a lot of default pushing and recursion to make it happen.
[9:12pm] merlinofchaos: And during editing, everything is stored back on the display and put into a temporary location until the final save.
[9:13pm] merlinofchaos: Don_Ricardo: If you want to add nesting, you probably actually need to put something in the form for the style.
[9:13pm] merlinofchaos: That's where I would investigate.
Useful links
Comments
Comment #0.0
alexander allen commentedMinor edits
Comment #0.1
alexander allen commentedMinor edits
Comment #0.2
alexander allen commentednitpicking!
Comment #1
alexander allen commentedNotes:
- Unless more developers get involved with this issue, I will begin initial development on a local topic branch.
- If I manage to make any substantial progress on this, I will post a patch first for community review.
- No pushes to the remote repository will be done until the new code gets reviewed.
- If we get to this point, we can then discuss if we want to create a new branch (7.x-2.x) or just release into the 7.x-1.x branch.
Comment #2
alexander allen commentedFYI, currently working with setting up my local git structure, probably including the topic branch into a larger drupal install as a submodule or subtree merge.
Comment #3
pasqualleyes, nice feature
I can imagine some kind of tree (like the taxonomy edit page) where you can set the attribute name (in textfield) and select the views field (in select) for that given attribute.
like
(for multi-value fields like the field_image the user should be able to choose a formatter, or choose an index to display 1 value only.)
but I have no tangible idea how to achieve this..
Comment #4
alexander allen commentedConsolidated comment into issue description.
Comment #4.0
alexander allen commentedConsolidated comment into issue description
Comment #5
alexander allen commentedMoved comment to issue description.
Comment #5.0
alexander allen commentedmarketing grammar?
Comment #5.1
alexander allen commentedCreated a list for tracking tasks in a more organized fashion :)
Comment #6
alexander allen commentedChanged title to reflect the scope of the issue.
Comment #7
alexander allen commentedComment #8
alexander allen commentedThis is an example of a user requiring attributes: node 1613724.
Marked that ticket as duplicate.
Comment #9
dakke commentedSubscribing. Most definitely...
Comment #10
alexander allen commentedAdded to #1623606: Views Datasource 2.x branch, has dependency on #1699368: #RVDA: Rewrite Views Datasource's Architecture.
Comment #10.0
alexander allen commentedAdded date to transcript
Comment #11
heylookalive commentedHas there been any progress on this?