Allow Lists of Strings in GraphQL views

Created on 18 February 2025, 6 days ago

Problem/Motivation

I need to create a view which one of the fields is multiple. It is an entity reference field which references multiple images. I need to display this field as a list of urls. Example:

images: [
  "https://example.com/example-img.jpg",
  "https://example.com/example-img-2.jpg"
]

I am already able to show the image as a string with a formatter, but currently it is not possible converting the urls to an array, instead of a plain text.

It would be nice to have the possibility to return multiple fields as arrays.

Steps to reproduce

  1. Create a content type with a multiple field.
  2. Install GraphQL compose views
  3. Create a view of that content type, with a GraphQL display that shows fields.
  4. Add the multiple field, and configure the 'Multiple fields settings' section with "Simple separator".

At this point, the field appears like this:

images: [
  "https://example.com/example-img.jpg, https://example.com/example-img-2.jpg"
]

Proposed resolution

Allow selecting a new type at the fields settings, named 'List (String)' that would return the field value as an array, separated by the delimiter configured at 'Multiple field settings' section.

Feature request
Status

Active

Version

2.4

Component

Code

Created by

🇪🇸Spain omarlopesino

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024