Generated with the help of an LLM.
Problem/Motivation
Split from #3627256: IslandInterface: name the instance $instance, and settle the island API before RC1. build() and the on*() methods of an island return array, and the base returns [] for an event the island ignores. An empty array renders nothing, so it means "no update".
An island emptying its content in reaction to an event has no result of its own: it returns its wrapper with no content.
DisplayBuilderEventsSubscriber::dispatchToIslands() still skips a NULL result, which the return types rule out.
Proposed resolution
To decide: keep [] as "no update" and document how to empty an island, or let on*() return ?array with NULL as "no update".
The first is docs only. The second changes the interface, so it lands before RC1 or not before 2.0.
Remaining tasks
- Decide.
- Docblocks of
IslandInterfaceandIslandEventSubscriberInterface, anddocs/island-plugins.md. - Drop the dead
NULLcheck, or make it live.
User interface changes
None.
API changes
None, or ?array on the on*() methods.
Data model changes
None.
Issue fork display_builder-3635780
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pdureau commentedAs shared in #3627256, I would recommend to stick with the original plan (
?array), to be able to express both:NULL: no updateIs there something going against this?
Comment #3
mogtofu33 commentedComment #4
mogtofu33 commentedComment #5
pdureau commentedI will add
?arrayon theon*()methods.There is already this in
DisplayBuilderEventsSubscriber::dispatchToIslands():So we can guess it was the expected behaviour.
Comment #7
pdureau commentedJust some linting and we are good
Comment #8
pdureau commentedMain changes:
IslandEventSubscriberInterface, of courseNULLinstead of empty when no updateDisplayBuilderEventsSubscriberis hosting the added logic about NULL VS Empty.ApiSseControllerdoesn't need it own check anymoreSome added tests.
IslandPluginBaseTestis the only one modified, which is comforting.Comment #10
mogtofu33 commentedMErging, thanks, keep a change record on my side.