Problem/Motivation

tag attribute for source plugins hide some complexity and risks

There are 10 tags used in UI Patterns sources (numbers are bigger than the number of plugins because of the derivers:

  • context_switcher: 21 (in EntityReferenceFieldPropertyDerivableContextDeriver, EntityFieldSource and EntityReferencedSource)
  • entity: 527
  • entity_referenced: in EntityReferencedDerivableContextDeriver
  • field: 526
  • field_formatter: 334 (only in FieldFormatterSourceDeriver)
  • field_label: 1 (only in FieldLabelSource)
  • field_property: 191 (only in EntityFieldSourceDeriverBase)
  • field_storage: 143 (only in EntityFieldSourceDeriverBase)
  • views: 2 (+ 8 in Display Builder)
  • widget: 11 (+1 in UI Icons)
  • widget:dismissible: 5 (+ 1 in UI Icons)

Are they used?

  • context_switcher: yes, in ComponentFormBase
  • entity: never?
  • entity_referenced: in some context switchers
  • field: yes, in EntityFieldSource, ContextMatcherPluginManagerTrait, EntityReferencedDerivableContextDeriver
  • field_formatter: never
  • field_label: never
  • field_property: never
  • field_storage: never
  • views: never
  • widget: yes, by SourceComponentWidget, ComponentFormBase and context switchers
  • widget:dismissible: yes, by SourcePluginManager and in context switchers

Proposed resolution

  1. Add an enum with the used values and clear inline documentation.
  2. Remove from source plugins the tags not used
  3. Prepare the future removal of tags attributes which can be replaced by check of Interfaces or more specific tags
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

Issue summary: View changes

pdureau’s picture

Assigned: pdureau » Unassigned
Status: Active » Needs review

DONE.

The 2 phpunit fails don't seem related to the current work and are also met in many tickets including #3589204: Drupal 12 and phpunit and #3590426: Reduce the API scope of our plugin managers:

1) Drupal\Tests\ui_patterns_layouts\Functional\LayoutBuilderRenderTest::testRenderSlotsReplaced
Behat\Mink\Exception\ElementTextException: The text "field_text_1 value" was not found in the text of the element matching css ".ui-patterns-test-form-replaced-slot".
2) Drupal\Tests\ui_patterns_layouts\Functional\LayoutBuilderRenderTest::testRenderSlots
Behat\Mink\Exception\ElementTextException: The text "field_text_1 value" was not found in the text of the element matching css ".ui-patterns-slots-slot".
pdureau’s picture

Assigned: Unassigned » just_like_good_vibes

Ready

pdureau’s picture

Do we need to add "prop_type_compatibility:converted" in the enum?

pdureau’s picture

Assigned: just_like_good_vibes » pdureau
Status: Needs review » Needs work

Some tags may be missing...

pdureau’s picture

Assigned: pdureau » just_like_good_vibes
Status: Needs work » Needs review
pdureau’s picture

This is the 1st part of a three steps effort to prepare UI Patterns Next while staying in 2.0.x branch for now: https://docs.google.com/presentation/d/11NsN1c5prlWrB0AlEKOxE4q5MOFHx-N_...

Added enums:

  • SourceTags: string

Removed tags:

  • entity
  • field_storage
  • field_property
  • field_formatter
  • field_label
  • ui_patterns_source
  • views
smovs’s picture

Status: Needs review » Reviewed & tested by the community

I reviewed MR and tested workflow of Source plugins on my local copy. Looked solid to me

just_like_good_vibes made their first commit to this issue’s fork.

pdureau’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Reviewed & tested by the community » 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.