Multiple fields are not rendered. I think this is due to the use of $field->options['multiple']['group'] (views_xml.module, line 118); multiple is no longer in the options array.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jec006’s picture

Status: Active » Needs review
FileSize
17.82 KB

I've created an initial patch for this - I think there are some other things that need to get cleaned up, but this at least makes things render correctly (i.e. multiple fields with the 'display in single row' option checked now display in an array.

It appears much of this code wasn't updated for views 3 and so wasn't working properly. I have fixed the issue for each of the outputs, but have really only tested with json.

jec006’s picture

Here is a new patch - the old patch seems to fail with a makefile since it edits the info file and drush adds stuff.

cbrasfield’s picture

Thank you!

cbrasfield’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Les Lim’s picture

Status: Closed (fixed) » Needs review

Resetting status; issues shouldn't be marked as fixed until the patch is committed to the project.

Anonymous’s picture

Thanks allot for the patch. Works perfectly. Would be nice to see this committed to the next version.

david.mccandless’s picture

+1 for me on adding the patch to the project. Works great for me. Thanks to jec006 for saving me some time!

cbrasfield’s picture

Eek, apologies for setting the wrong status. This is what I get for not double checking key strokes.

gaele’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
gfrenoy’s picture

The patch really helped but it was not possible to have 2 times the same field with two different output.
Moreover, I noticed some little glitches in the code (as using undefined variable and wrong copy/past of json function in xml/xhtml/rdf modules.

Just attached a new patch that fixes those problems.

gaele’s picture

Status: Reviewed & tested by the community » Needs review
likewhoa’s picture

Status: Needs review » Needs work

patch doesn't seem to do what i was expecting as I am still getting my 'multiple value' link field type to show values on one line i.e

{
  "nodes" : [
    {
      "node" : {
        "nid" : "1",
        "title" : "Oh. You need a little dummy text for your mockup? How quaint.",
        "type" : "page",
        "Body" : "foobar",
        "Image Block" : [
          "Image Title: Image title 1Image Description: image description 1Destop Image: Mobile Image: Image Link: link 1",
          "Image Title: Image title 2Image Description: description 2Destop Image: Mobile Image: Image Link: link 2"
        ]
      }
    }
  ]
}

It should really output that image block multiple field as separate sections, something like.

                "Image Block":  [
                   {
                    "Image Title": "Image Title 1",
                    "Image Description": "Image Description 1",
                    "Image URL": "http://localhost/image1.jpg"
                   },
                   {
                    "Image Title": "Image Title 2",
                    "Image Description": "Image Description 2",
                    "Image URL": "http://localhost/image2.jpg"
                   }
                   ]

Note this same output of having the fields in one line is also encounter with fieldcollection fields.

likewhoa’s picture

liquidcms’s picture

wondering status of this.. it sounds like a duplicate of #1319714: Fields with multiple values are not displayed but that is marked as closed with fix in alpha2 and this patch predates that rel.

also, i don't think this is fixed in -alpha2

deen1ce’s picture

Status: Needs work » Needs review
FileSize
17.57 KB

The patch #11 did not apply.
Manual reroll, see attached file

killes@www.drop.org’s picture

The patch #11 does not work with field rewriting.

killes@www.drop.org’s picture

Status: Needs review » Needs work

changing status.

I have a list of nodes with a taxonomy field. There can be more than one term in the field. I need to output both the term name and the term id. To output the id I use rewriting, but this fails with this patch.

killes@www.drop.org’s picture

I doesn't really work well without the patch: only the first term's ID is shown.

studio-days’s picture

#16 works like a charm. Thanks for this, been searching for ages. For anyone looking, this patch will convert your multi-valued fields into arrays.

jlongbottom’s picture

#16 worked for me as well. thanks!

shelane’s picture

Status: Needs work » Reviewed & tested by the community

Patch on #16 is working for me. I hope this can get merged rather quickly since it was an issue reported 4 years ago.

anthonylindsay’s picture

Status: Reviewed & tested by the community » Needs work

So the patch on #16 does turn multiple values into an array, which is great... but if you use grouping (which was just added), it breaks and you get no data returned. It'll need to be re-worked against the latest dev, I'm afraid.

ZeiP’s picture

Status: Needs work » Needs review

What kind of configuration doesn't work with the patch? I'm using it in the most recent VCS version and using both grouping per nid and multiple values works pretty well, except for the issue I patched in #2955990: Grouping adds unnecessary arrays and key to the structure, which still doesn't cause the data to be completely missing. Setting back to Needs review, feel free to change back if the problem still arises.

roadlittledawn’s picture

#16 works for me. nice work! this is going to be super useful for our team. we're exposing our content in json for other external apps in our company to consume. nice to see some dev work around this module to make it even more robust.

ZeiP’s picture

Assigned: Unassigned » ZeiP
Status: Needs review » Reviewed & tested by the community

A few users have reported this to be working correctly, so moving to RTBC.

ZeiP’s picture

There was a small typo causing the XHTML format to break when using the patch. Attached is a fix for that.