Problem/Motivation

Child 6 of #3624396: Plan: Harden InstanceInterface, IslandInterface and DisplayBuildableInterface as public API before RC1. An island with a form, the four Contextual panels today, gets it through a pattern of its own:

  • IslandWithFormInterface declares static getFormClass() and hasFormClass(). Core's PluginWithFormsInterface has the same names as instance methods taking an operation, so an island cannot implement both, and the statics cannot be deprecated in place.
  • ApiController calls getFormClass() on a class name, twice.
  • The form gets its data in three shapes: on render, on update and on a third party settings update. The keys mislead: builder_id holds the instance ID, instance_id the node ID, and instance the node data.
  • setBuilderId() and setNodeId() pass state the build info already carries. setNodeId() has no caller.
  • One form ID per island, the fix of #3623715: Island forms share one form id and load each other's cached state, has no test.

Proposed resolution

  • #[Island] gains forms. Islands implement PluginWithFormsInterface through PluginWithFormsTrait. configure stays the profile form. The in-builder form gets its own operation, contextual, named after where it shows, as core names the settings_tray form of blocks.
  • IslandFormBase builds the plugin form through plugin_form.factory, with one build info shape on every path: island ID, instance ID, node ID, node data, contexts. Named as #3627256: IslandInterface: name the instance $instance, and settle the island API before RC1 names them.
  • The static getFormClass() and hasFormClass() leave IslandWithFormInterface before RC1, with a change record. ApiController asks the island plugin instead of its class.
  • setBuilderId() and setNodeId() removed: the build info carries what they set.
  • One form ID per island stays, display_builder_island_{island_id}: plugin_form.factory returns a subform, so IslandFormBase stays the wrapper that owns the ID.
  • Tests: an island form gets the same build info on render and on submit, and two island forms on one page never share cached state, which closes #3623715: Island forms share one form id and load each other's cached state.

Remaining tasks

User interface changes

None.

API changes

  • IslandWithFormInterface::getFormClass() and hasFormClass() removed. Islands with a form implement PluginWithFormsInterface, and declare forms on #[Island].
  • One build info shape for island forms, with renamed keys.
  • setBuilderId() and setNodeId() removed: the build info carries what they set.

Data model changes

None.

Comments

mogtofu33 created an issue. See original summary.

mogtofu33’s picture

Issue summary: View changes
mogtofu33’s picture

Priority: Normal » Major
mogtofu33’s picture

Issue summary: View changes
mogtofu33’s picture