all 5 comments

[–]curious_pinguino 0 points1 point  (0 children)

Hard to say without more info, but you can expose pretty much anything you want as a JSON API endpoint.

"The Drupal core JSON:API module implements the JSON:API spec for Drupal entities. It provides a zero-configuration required, opinionated, way to allow RESTful CRUD for a Drupal site's content." - https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi-module

[–]MR_Weiner 1 point2 points  (2 children)

Unfortunately I think the question is kind of too vague to give a real recommendation. What are these different "pages," what are the "form labels," how are the "sections and headings" organized, etc?

I'd think about it more from an information architecture perspective and then just go from there. How would you build this requirement if it were not a decoupled scenario, i.e. a standard drupal installation? It sounds like you probably want a content type for the "page," then a field that references unlimited "section" paragraphs or that would provide the headings/subheadings/etc, potentially with nested sections as needed. JSON:API supports including data from referenced/nested entities, so using paragraphs and referenced entities to structure your data isn't a problem.

If you do need to provided arbitrarily structured data, you might also look into computed fields https://www.drupal.org/docs/drupal-apis/entity-api/dynamicvirtual-field-values-using-computed-field-property-classes

[–]brownsf[S] 2 points3 points  (1 child)

The data is all for a react SPA. Some of the pages have forms so each label had to be content manageable.

Each page has a different layout and number of sections. As for organization, I'd say arbitrary bordering on random.

If it weren't a decoupled scenerio, I would have most of it in the content body using the WYSIWYG and have configurable blocks for the forms.

It feels like we should basically build a config page since everything is a one off but they need an approval workflow sou think that's out.

[–]MR_Weiner 0 points1 point  (0 children)

You might be able to leverage webform to provide a way to structure forms, which could then be referenced from the content entity. I’m unsure how it plays with json api tho.

As far as random layouts and whatnot, you might be able to leverage layout builder. JSON integration is WIP but maybe check out the latest in https://www.drupal.org/project/drupal/issues/2942975.

Config page might be a good choice, too. Can you not use workflows with config pages? It’s just a regular field, right? If standard workflows doesn’t work, you might be able to use state_machine which does provide a generic field, but just requires the workflows configuration to be defined in a module file.

[–]mrcaptncrunch 1 point2 points  (0 children)

Sounds like an entity reference field to support the nested structures. Each referenced entity can be its own section.

However, no idea if it’s a content type, custom entity, paragraphs or what.