Add ViewTransform to Transform API for JSON Output

Created on 23 May 2024, about 1 month ago
Updated 19 June 2024, 12 days 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.69.0 2024