[2.0.0-beta1] Add alterInfo('component_info') hook

Created on 9 January 2024, 11 months ago
Updated 5 August 2024, 5 months ago

Problem/Motivation

This issue was initially about resolving Twig namespaces in _template property:

Since πŸ“Œ [2.0.0-alpha1] Make our plugin manager ready SDC in Core Fixed we are now able to add custom template path to the component instead of relying on automatic discovery only.
However, we don't support Twig namespaces yet. In the component plugin manager, if the path start with "@", resolve the namespace to get the path.

However, we are choosing a more general approach by implementing

SDC in Drupal core has a strong statement about this:

    // Note that we are intentionally skipping $this->alterInfo('component_info');
    // We want to ensure that everything related to a component is in the
    // single directory. If the alteration of a component is necessary,
    // component replacement is the preferred tool for that.

https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co...

But we want to allow our community to alter some:

Proposal

1. Add alterInfo('component_info')

I guess it happens in the construct method.

2. Remove code related to _template property

We remove this feature from UI Patterns 2 scope, but we know some people need it. Thanks to alterInfo('component_info')

3. Check if this change allows ✨ [2.0.0-alpha1] Expose default attribute prop in forms? Active

The default attribute object it is visible in Form Builder only when the prop is explicitly present in the definition file (which is not a good practice).

We don't do it automatically by default because some (most?) projects doesn't want the attributes to be exposed for every components.

However, if a project wants this attributes visible by default, he can add it by using this $this->alterInfo('component_info') hook.

Is it OK?

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France pdureau Paris

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024