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):
bug

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 (or default_region?) property in Island attributes.
  • region is already a generic property of display_builder.islands.* 👍
  • Set the default region to all View panels islands
  • Move IslandTypeViewDisplay to a generic mechanism (a single IslandRegion? An enum per IslandType ?) Each Type can have a region enum or not, with a default region.

What else?

Command icon 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

pdureau created an issue. See original summary.

pdureau’s picture

grimreaper’s picture

Assigned: Unassigned » grimreaper
pdureau’s picture

grimreaper’s picture

Category: Task » Feature request

As discussed, I went beyond to also propose start and end for buttons.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Needs review
pdureau’s picture

Rebased. Pipeline all green.

  • mogtofu33 committed b64887b0 on 1.0.x authored by grimreaper
    feat: #3555920 Make islands' region system more generic
    
    By: pdureau
    By...
mogtofu33’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.