Custom theme types and resource references

Trace type registration, the Admin picker, public data, and theme rendering through an inquiry form.

Register a selectable type when several sections need the same business resource, and store a reference in each section. The inquiry form shows the pattern: Service resolves public data, Admin selects the form, and Theme renders it.

Choose a data contract

For a title, body, or image that editors enter each time, start with an existing field type. When multiple sections need the same business resource, such as an inquiry form on both the homepage and contact page, give the resource its own lifecycle. Each section stores a reference. The form resource owns its questions.

Trace the inquiry form across the three projects

Layer Entry points What the inquiry form registers
Service packages/service/features/survey/cms-type.ts and packages/service/app/cms.ts defineCmsType assembles the value, resource, and public resolver, then the app registers them
Admin apps/admin/src/features/survey/cms-type.ts and apps/admin/src/config/form.ts defineAppFormRegistration provides picker controls, value mappings, and list presentation
Theme packages/theme/sections/contact1/ Declare the survey setting in setting.ts, read section.value("survey"), resolve it with the page payload, and render the form

The theme can use findSurvey(payload, value) from @platform/theme/refs.ts to look up a resolved public form. The existing section handles missing forms and forms with no displayable questions. When adding a resource, have its public resolver return the data visitors need. Keep internal state, management fields, and submission records in the business feature.

The survey registration declares manifest: false. It is available through integrated theme settings. Fixed site, module, and entry fields follow the manifest field-type contract. For a news section, see content modeling.

Verify the flow one step at a time

  1. Open the section in Admin, find a resource in the picker, save, and reopen the section to verify the reference.
  2. Exercise a resolved reference, an empty value, and a resource that cannot be resolved publicly. Give the component a usable layout in the last case.
  3. Select the same published form in two different layouts. Check the questions in both and submit a test response on each.
  4. Update the public form content. Check preview and the public pages after publication, and confirm both show the updated resource.

Use the section development tutorial to start with a local mock. Verify public resource resolution with Service and Admin in a test environment.