Problem/Motivation

The current block UX tries to serve too many use cases at once. Selecting a mapping in block configuration, supporting a current-route option, and entering a raw entity ID makes the block less clear for site builders and less friendly for Canvas-based placement.

screenshot showing the clunky Canvas UI.

A clearer model is to treat each saved mapping as its own block/component entry, let the editor choose the source entity with autocomplete, and use component example data when no entity has been selected yet so the component is visible immediately in Canvas.

Steps to reproduce

  1. Create one or more SDC Entity Mapping configuration entities.
  2. Place the generic mapped component block or add it through Canvas.
  3. Observe that the editor must choose a mapping in block configuration, may see a current-route option, and may need to enter a raw entity ID.

Proposed resolution

  • Derive one block plugin definition per enabled mapping.
  • Remove the mapping selector from block configuration.
  • Remove the current route entity option.
  • Replace the raw entity ID field with entity autocomplete.
  • When no entity has been selected, render the component with example prop values so it is immediately visible in Canvas.

Remaining tasks

  • Update the block plugin and derivative logic.
  • Update block schema and validation.
  • Update automated test coverage.
  • Confirm Canvas library/discovery behavior with derived mapping blocks.

User interface changes

  • Each mapping appears as its own block/component entry.
  • Block configuration asks only for the source entity.
  • The source entity is selected with autocomplete instead of manual ID entry.
  • The component is visible immediately in Canvas using example data until an entity is chosen.

API changes

  • No base-module API changes.
  • The block submodule changes from a single configurable mapping block to derived block definitions per mapping.

Data model changes

  • No changes to the mapping config entity data model.
  • Block configuration changes from storing mapping plus entity selection to storing only entity selection.
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

jcandan created an issue. See original summary.

  • jcandan committed 4dc2f015 on 1.x
    feat: #3585427 Refine block UX for Canvas: derive one block per mapping...
jcandan’s picture

Status: Active » Fixed
StatusFileSize
new128.95 KB

I am pretty happy with this result.

screenshot of the refined block UX.

Note: this is a breaking change and, being a development branch, does not include any configuration updates. If having tinkered with this development branch you wish to update, you will need to run a fresh install.

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.