Problem/Motivation

UI Patterns 2

UI Patterns 2 is shipped with those context for sources:

Context Example context_definitions context_requirements
Content entity EntityLinksSource entity X
Field FieldLabelSource entity & field_name field_formatter
Field item FieldPropertySource X field_granularity:item (via deriver)
View (everywhere) ViewTitleSource entity:view X
View (all rows) ViewRowsSource entity:view views:style
View (each row) ViewFieldSource entity:view views:row

The mix between context_definitions and context_requirements is a bit complex, and some context_requirements naming are too specific (field_formatter for example).

There are some plans to add a "Content" context (not the same as "Content entity" for sources which can be stored only in a content field (for Layout Builder overrides or Ckeditor5 for example): #3501797: Add a ContentEntity source for slots with a Content entity context

Display Builder

The module doesn't use context_definitions and has those context_requirements:

  • is_display_builder_views. Example: ViewExposedSource
  • is_display_builder_page_layout. Example: PageTitleSource

Those contexts don't tell about where we are in the Drupal API, what we have access from the source, but about the specific Display Builder sub-module using it. So, they sources will not be compatible with the UI Patterns 2 ecosystem and the future Display Builder ecosystem.

In a perfect world, Display Builder will have no Source plugins in its codebase.

Proposed resolution

Instead of is_display_builder_views, use the ones already defined and managed by UI Patterns 2.

Instead of is_display_builder_page_layout . Add a "Page" context which will be able to be proposed for UI Patterns 2 inclusion. See #3529737: Add proper page management

The future Content context from UI Patterns 2 must follow the same principles because it will also be used in Display Builder Entity View's overrides. We can implement it first in Display Builder.

If it is the opportunity to propose a backward compatible simplification to UI Patterns 2 team, let's do it.

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
Issue tags: +display_builder-1.0.0-alpha3
pdureau’s picture

Assigned: Unassigned » just_like_good_vibes

Following our discussion, can you check what can be done?

On UI Patterns 2

By maybe cleaning and tidying (removing field_formatter context_requirements for example) the existing.

By creating a centralized, standardized, nomenclature to manage our 8 contexts:

Context (as understood by users) Example of source plugin Notes
Content entity EntityLinksSource
Field FieldLabelSource
Field item FieldPropertySource
View (everywhere) ViewTitleSource
View (all rows) ViewRowsSource Do we merge with View (everywhere)?
View (each row) ViewFieldSource
Content #3501797: Add a ContentEntity source for slots with a Content entity context
Page DisplayBuilder's PageTitleSource

So, all UI Patterns 2 ecosystem knows what is available.

By better documenting the attributes in https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/src/Attribut...

On Display Builder

By replacing is_display_builder_views and is_display_builder_page_layout by the ones from the centralized, standardized, nomenclature.

pdureau credited mogtofu33.

pdureau’s picture

pdureau’s picture

FYI, in #3534215: Implement WithDisplayBuilderInterface in Views is_display_builder_views will become views:style

pdureau’s picture

pdureau’s picture

Title: Align source contexts » [2.0.x] Align source contexts
Component: Main / Misc. » Documentation
Assigned: just_like_good_vibes » Unassigned
Status: Active » Closed (duplicate)
Issue tags: -display_builder-1.0.0-alpha4

To move to UI Patterns 2 where we only do this little tasks:

  • Removing field_formatter context_requirements for example) the existing.
  • Document the architecture by adding a Markdown file in /docs/3-devs
pdureau’s picture

Title: [2.0.x] Align source contexts » Align source contexts
pdureau’s picture

pdureau’s picture

pdureau’s picture

Status: Closed (duplicate) » Active
Issue tags: -display_builder-1.0.0-alpha4 +display_builder-1.0.0-beta

Finally, still needed in Display Builder to rename is_display_builder_page_layout

pdureau’s picture

Assigned: Unassigned » pdureau
Issue tags: -display_builder-1.0.0-beta +display_builder-1.0.0-alpha4
pdureau’s picture

Assigned: pdureau » Unassigned
Issue tags: -display_builder-1.0.0-alpha4 +display_builder-1.0.0-beta

Finally, still needed in Display Builder to rename is_display_builder_page_layout

More complicated than expected, because when the Drupal blocks are duplicated in the block library. It is because LocalActionsSource and LocalTasksSource are extending Drupal\ui_patterns\Plugin\UiPatterns\Source\BlockSource which is implemntign the SourceWithChoice interface.

pdureau’s picture

Status: Active » Closed (won't fix)
Issue tags: -display_builder-1.0.0-beta +display_builder-1.0.0-alpha4

Will be done in #3529468: Remove ui_patterns_overrides because the 2 subjects are too linked.