Problem/Motivation
We have a bug when creating a new Profile. Some View panels have no region set and they appear in the unexpected one (Main instead of Sidebar):

The logic may be wrong in ProfileForm:
// If new, only library is on sidebar by default.
// @todo move this position option to Island configuration.
if ($id !== 'library' && !isset($configuration['region']) && isset($definition['enabled_by_default'])) {
$region = IslandTypeViewDisplay::Main->value;
}
else {
$region = $configuration['region'] ?? NULL;
}
Proposed resolution
Instead of fixing the bug, it may be the opportunity of improving and future-proofing the logic.
All island types could have a region. We are using the feature only for View panels for now but, for example, we may want to use it for Buttons later (position buttons at the start are the end of the toolbar).
Also, it will help us to propose the Island plugin type to other projects: #3554417: Isolate islands logic to its own module
- Add a
region(ordefault_region?) property inIslandattributes. - region is already a generic property of
display_builder.islands.*👍 - Set the default region to all View panels islands
- Move
IslandTypeViewDisplayto a generic mechanism (a singleIslandRegion? An enum perIslandType?) Each Type can have a region enum or not, with a default region.
What else?
| Comment | File | Size | Author |
|---|
Issue fork display_builder-3555920
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 commentedComment #3
grimreaperComment #4
pdureau commentedComment #5
grimreaperAs discussed, I went beyond to also propose start and end for buttons.
Comment #7
grimreaperComment #8
pdureau commentedRebased. Pipeline all green.
Comment #10
mogtofu33 commented