Module Description
Motivation This module enhances the REST export functionality in Views to solve the following use cases:


* Your field has multiple values. You want to render each item, but export them as an array instead of a single string.
* Your field contains data that is a JSON primitive (ie. a boolean or number). You want to export this value as the correct type, instead of a string.
* Your field is an entity reference. You want to export the target entity as a nested object, instead of a single string.

Architecture The reason this utility can be necessary is due to Drupal core's views being tightly coupled with the render system, which implicitly assumes that it is working with HTML output. A REST view display uses this same system to gather and process data, and then passes the render array to a serializer instead of rendering it to HTML.

In order to export rich data without turning it into strings, this module uses a trick: It provides a custom views field handler that returns an object which the render system considers a "Markup" object, but which will be turned back into data when passed to the JSON serializer.

Usage After installing this module, each entity field can be accessed in Views via a new handler named "Field (Serializable)".

This field handler automatically exports multiple-value fields as arrays. This is dependent on the cardinality in the schema, so it will be applied even if the field contains less than two actual values.

Furthermore, several field types will have new field formatters designed to export non-string values, including:


* Boolean
* Numeric
* Entity Reference
* Entity Reference Revisions
* Image

Note that these will only work in combination with the Serializable handlers.

Project Usage
2222
Creation Date
Changed Date
Security Covered
Covered By Security Advisory
Version Available
DEV
Module Summary
This module enhances the REST export functionality in Views to export rich data without turning it into strings.
Data Name
rest_views

OPENAI CHATBOT

OPENAI CHATBOT

14:25:35
Generic Chatbot
Hi, I'm a Drupal module expert powered by OpenAI, answering your questions about the Drupal module ecosystem. How can I be helpful today? Please note that we will log your question.