Add ViewTransform to Transform API for JSON Output

Created on 23 May 2024, 6 months ago
Updated 3 July 2024, 5 months ago

Problem/Motivation

The Transform API module currently lacks support for transforming Views into JSON. Adding this capability will enable site builders to leverage Views for headless and decoupled applications.

Steps to reproduce

  1. Create a View.
  2. Enable JSON output with the ViewTransform.
  3. Access the View with ?format=json and verify the JSON structure.

Proposed resolution

  1. Implement ViewTransform to handle Views and generate JSON output including view metadata.
  2. Example Output:
    {
      "type": "view",
      "view_id": "frontpage",
      "display_id": "page_1"
    }
  3. Include methods:
    • processRow: To handle individual rows.
    • processExposedFilters: To handle exposed filter data.
    • processPager: To handle pagination data.

Remaining tasks

  • Implement the processRow, processExposedFilters, and processPager methods.
  • Write unit and functional tests.
  • Update documentation.

User interface changes

Add administrative interface to enable JSON transformation for specific Views.

API changes

  • Introduce new ViewTransform class.
  • Add related hooks for extendibility.

Data model changes

No data model changes required.

Feature request
Status

Needs work

Version

1.0

Component

Plugins

Created by

🇩🇰Denmark madsnorgaard

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

Comments & Activities

Production build 0.71.5 2024