Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16159

Drupal Views civicrm_contact field isn't rendering multiple values correctly

    Details

    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Drupal 7.35, CiviCRM 4.5.6

      Steps to reproduce:

      1. Create a Drupal content type with a "CiviCRM Contact" field type.
      2. Configure the field to accept multiple values.
      3. Create a node with that content type in which the field has multiple CiviCRM Contact values.
      4. Create a view displaying nodes of this content type, with fields.
      5. Add a field display for the CiviCRM Contact field. In the "Multiple field settings" drop-down, select "Ordered list" and display all values.
      6. Save and look at the view.

      Expected result: View displays row with multiple contacts listed in the form:

      1. Contact One
      2. Contact Two
      3. Contact Three

      Actual result: View displays row with multiple contacts listed in the form:

      1. Contact One Contact Two Contact Three

      Notes:

      I looked to see if this issue was reported anywhere else and couldn't find anything relevant. Apologies if I missed it.

      I actually ran across this initially because it seemed like CiviCRM Contacts weren't respecting the "separator" setting in views (I wanted the contacts listed in order separated by commas). Then I tried switching to ordered list and realized it was because CiviCRM Contacts seemed to be getting shown to Views as one single value, so there was nothing from Views' perspective to separate.

      If you compare this to the way Drupal taxonomy terms are rendered, you can see the HTML in the view is different. Whereas multiple taxonomy terms in a view (comma-separated) look like this:

      <div class="field field-name-FOO field-type-taxonomy-term-reference">
      <a href="/tags/bar">bar</a>
      ,
      <a href="/tags/baz">baz</a>
      </div>

      Multiple CiviCRM Contacts in a view look like this:

      <div class="field field-name-FOO field-type-civicrm-contact-ref-contact">
      <a href="/civicrm/contact/view?reset=1&cid=1">bar</a>
      </div>
      <div class="field field-name-FOO field-type-civicrm-contact-ref-contact">
      <a href="/civicrm/contact/view?reset=1&cid=2">baz</a>
      </div>

      This is probably minor stylistically (I can insert commas with CSS) but because it seems like the field value isn't being delivered to Views properly I thought it was worth reporting.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rootwork Ivan Boothe
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: