Allow import of simpler fields JSON without nested value array

Created on 29 January 2025, 4 months ago

Problem/Motivation

The Drupal 7 version of FillPDF accepted JSON imports that looked like this:

{
  "Page01-YourFirstName": {
    "label": "First Name",
    "value": "[node:field-first-name]",
    "replacements": []
  }
}

FillPDF should continue to accept this simple format in addition to the more verbose current equivalent:

<code>
{
  "fields": {
    "Page01-YourFirstName": {
      "pdf_key": [
        {
          "value": "Page01-YourFirstName"
        }
      ],
      "label": [
        {
          "value": "First Name"
        }
      ],
      "prefix": [],
      "value": [
        {
          "value": "[node:field-first-name]"
        }
      ],
      "suffix": [],
      "replacements": []
    },

This is particularly important for us because we have a hundred fields defined in the above format!

Proposed resolution

Transform the concise format into the expanded form automatically when it is imported.

Remaining tasks

User interface changes

None.

API changes

Accept import JSON without optional fields, without nested/redundant single value array.

Data model changes

None.

✨ Feature request
Status

Active

Version

5.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

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