Hello. I try to use Double field module on my Drupal 8.1.x site with standard RESTful and Views modules (core).

But JSON output in my view (with double field, for ex. 2x text fields) show me split values of two field.

May I get array of this double field, like:

[0] => field_first, [1] => field_second

Help me, please.

Comments

enjoyiacm created an issue. See original summary.

chi’s picture

Title: How to use module with RESTful in Drupal 8.1.x » How to display sub-fields in a view separately?
Component: Code » Documentation
Category: Feature request » Support request
Priority: Critical » Normal

There is nothing special about REST export of double field. You can separate the subfields the same way as in other displays.

Basically the approach is as follows:

  1. Add double field to a view twice.
  2. For the first instance disable second subfield by checking "hidden" checkbox in formatter settings.
  3. For the second instance disable first subfield in the same manner.
koddr’s picture

2 Chi: yes, your right. But how to make this for multifields (type: Double field)?

koddr’s picture

2 Chi: I mean this.. Standard output of multifields is:

"field_my_field": [{
  "first": "first_1_value SEPARATOR first_2_value SEPARATOR...",
  "second": "second_1_value SEPARATOR second_2_value SEPARATOR..."
}]

How to make something like this:

"field_my_field": [{
  "0": [{
    "first": "value",
    "second": "value"
  }],
  "1": [{
    "first": "value",
    "second": "value"
  }],
  ...
}]

Any help?

chi’s picture

Component: Documentation » Miscellaneous

http://drupal.stackexchange.com/questions/192367/views-rest-export-and-m...
Same issue. Looks like there are no simple ways to accomplish this.

chi’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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