Allow component source plugins that don't have a plugin_id setting

Created on 29 January 2025, 2 months ago

Overview

JS Components don't use plugins and hence this doesn't make sense

Proposed resolution

Allow source components to not use a plugin ID

User interface changes

πŸ“Œ Task
Status

Active

Version

0.0

Component

Data model

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @larowlan
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡¬πŸ‡§United Kingdom longwave UK
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • niharika.s β†’ made their first commit to this issue’s fork.

  • Merge request !607rename β†’ (Open) created by Unnamed author
  • Pipeline finished with Failed
    2 months ago
    Total: 705s
    #413272
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    @niharika.s: wow, so nice to see this almost done! 🀩

    @larowlan:

    I was expecting each plugin to be able to define it's own settings and hence SDC and block components could retain plugin_id, whilst JS components could use something else.

    The problem with that is that that won't work with:

        id:
          # This ID intentionally does not use `type: machine_name`, because it is a composite ID that is better validated
          # using the `StringParts` constraint than the `RegEx` constraint.
          type: string
          label: 'Component'
          constraints:
            StringParts:
              separator: .
              reservedCharacters:
                - ':'
              reservedCharactersSubstitute: .
              parts:
                - '%parent.source'
                - '%parent.settings.plugin_id'
    

    This guarantees consistent, meaningful Component config entity IDs.

    See that last line there: that's immutable. There's no other way I know of in config schema to achieve this.

    I think

      label: 'Block component settings'
      mapping:
        local_source_id:
          label: 'Block plugin ID'
          constraints:
            PluginExists:
              manager: plugin.manager.block
              interface: Drupal\Core\Block\BlockPluginInterface
    

    is plenty clear: for every Block-sourced Component config entity, the local_source_id must be a block plugin ID. The validation constraint makes this firm.

    And the equivalent for a component source using config entitities:

      label: 'Code component settings'
      mapping:
        local_source_id:
          label: 'JS Component ID'
          constraints:
            ConfigExists:
              prefix: experience_builder.js_component.
    
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
Production build 0.71.5 2024