Overview

Postponed on #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface.
Postponed on #3475584: Add support for Blocks as Components.

To improve the UX of finding the Component that an XB user (Site Builder or Content Creator) is looking for, Components should be categorized.

As @lauriii described in #17 based on the designs (that have gone through multiple rounds of user testing — LINK TBD):

(In other words: we'll distinguish those based on the provider type: theme vs extension. Out of scope here: multiple installed themes.)

In all of the above, there will be categorizations:

  1. Library (default theme-provided SDCs): each SDC defines its own category — blocked on #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface
  2. Extensions (module-provided SDCs): each SDC defines its own category — blocked on #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface
  3. Dynamic components (block plugins): blocks have defined their own category for almost a decade now, since #2349991: Provide a trait for categorizing plugin managers and use it for conditions and actions — for example SystemMenuBlock has
    category: new TranslatableMarkup("Menus"),
    

Proposed resolution

  1. Store that category in the XB Component config entity
  2. … but only if the category is not Elements — unless the provider is the XB module itself. IOW: Elements is a reserved category
  3. Expose the category of each Component via ApiComponentsController to the client
  4. Update /openapi.yml accordingly

User interface changes

This will unblock the following UI/UX: https://www.figma.com/design/1sj0mnVdLFdYihrkAhR43u/Experience-Builder-%...

CommentFileSizeAuthor
#22 3459088-outline.patch4.43 KBwim leers
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

lauriii created an issue. See original summary.

lauriii’s picture

wim leers’s picture

Assigned: Unassigned » lauriii

What is this postponed on? On design? On an outcome of the discussion at #3455036: Clarify "components" vs "elements" vs "patterns"?

This affects #3444424: [META] Configuration management: define needed config entity types and would be one of the logical next things to work on now that #3452397: Allow specifying default props values when opting an SDC in for XB landed.

lauriii’s picture

I'm working with a UX designers and a researcher to define this. We have formed a hypothesis and we're planning to start testing on Monday.

wim leers’s picture

Title: Define built-in components and categorization for components » [needs design] Define built-in components and categorization for components
Issue tags: +blocker
lauriii’s picture

We are planning to launch a research utilizing unmoderated interviews + tree testing next Monday.

Objectives

  1. Define what building blocks are most important to the potential users of the Experience Builder (XB).
  2. Define the ideal menu IA for users to efficiently navigate the tool.
  3. Understand the limits designs systems are pushed to out in the marketplace and the ideal arrangement for users. (prioritizing mid-market level users, including enterprise data to keep designs scalable for their needs as well.

Users/Participants

We can target the following groups on PlaybookUX:

Personas:

  1. Designers (Maggie & Amir)
  2. Front-end developers (Clare & Keith)

Target Markets:

  1. Education/schools & Volunteer orgs (primary)
  2. Mid-market agencies (primary)
  3. Enterprise users
lauriii’s picture

Issue summary: View changes

Adding a link to Figma which has a benchmark + a hypothesis to test: https://www.figma.com/board/PtSgs0OuOaU1uwpstivpmM/Benchmark?node-id=0-1....

wim leers’s picture

This came up in a meeting with @larowlan — see the parenthetical at the bottom of #3454519-22: [META] Support component types other than SDC, block, and code components, quoted here for simplicity:

(For example, we also discussed the need for per-slot restrictions on which components would be allowed, which is possible in Layout Builder using https://www.drupal.org/project/layout_builder_restrictions, but that module has scalability issues — through no fault of its own — because the "tags" are not built in, resulting in hundreds of lines of YAML in third_party_settings 😳. That validates @lauriii's thinking to make that an inherent part — see #21.4. Related: #3459088: Every XB `Component` config entity should have a `category` property.)

Lee confirms the need for this based on real-world experience with Layout Builder 👍

wim leers’s picture

Title: [needs design] Define built-in components and categorization for components » [research] Define built-in components and categorization for components

Matching the issue title prefix pattern I used for #3455036: Clarify "components" vs "elements" vs "patterns".

wim leers’s picture

Title: [research] Define built-in components and categorization for components » [needs design] Define built-in components and categorization for components
Version: » 0.x-dev
Issue tags: +Needs design

IIRC @lauriii said that user testing around this has happened? Can we get the results posted here? 🙏

AFAICT this is necessary for #3455753: Milestone 0.2.0: Early preview because it's implied to be necessary for Place blocks as components?

kristen pol’s picture

I thought we had an issue for how the design system can specify tags/categories (in addition to group) so that the design system components are organized in a particular way.

I struggled to find such an issue and so maybe it was this issue I was remembering. But, I don't think this issue is focused on this topic, but rather a "level up" in terms of categorizing.

I know we had some discussions in Slack and in other issues about grouping/tagging/categorizing components... do we need a new issue for it? Or should it be part of this issue or part of another existing issue?

reneelund’s picture

Assigned: lauriii » reneelund
reneelund’s picture

Status: Postponed » Active

This is in progress, I am getting this issue ready for handoff for next weeks call!

wim leers’s picture

🥳

FYI: you can get preliminary feedback from people interested in this area by sharing Figma links ahead of that meeting. That'd make that meeting more productive too! 😄

(This information needs to be consumable by the community at large anyway, i.e. also be understandable by people outside that meeting.)

kristen pol’s picture

Very excited to see the designs!

lauriii’s picture

Title: [needs design] Define built-in components and categorization for components » Define built-in components and categorization for components
Assigned: reneelund » Unassigned
Issue tags: -Needs design

There is now design for this in: https://www.figma.com/design/1sj0mnVdLFdYihrkAhR43u/Experience-Builder-%...

Based on this, the key separation is the source of the components; module vs theme. The module provided components are listed under "Extensions" and theme provided components are listed in the sidebar "Library".

Inside "Extensions" and "Library", the categories are defined by components and there are no built-in categories there. These can ideally leverage #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface.

There's also no built-in components. There are Blocks which are exposed under "Dynamic Components". There is also a special category "Elements" in future which is reserved for Experience Builder. It allows XB to provide SDCs that are more close to web standards / HTML tags or design system atoms.

wim leers’s picture

Title: Define built-in components and categorization for components » Every XB `Component` config entity should have a `category` property
Component: Page builder » Config management
Issue tags: -blocker +Needs documentation
Parent issue: #3450592: [META] Front-end Kanban issue tracker » #3450586: [META] Back-end Kanban issue tracker
Related issues: +#3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface, +#3482393: HTTP API: update /xb-components to specify each `Component`'s `source`

Based on this, the key separation is the source of the components; module vs theme. The module provided components are listed under "Extensions" and theme provided components are listed in the sidebar "Library".

This will be implemented in #3482393: HTTP API: update /xb-components to specify each `Component`'s `source`.

Inside "Extensions" and "Library", the categories are defined by components and there are no built-in categories there. These can ideally leverage #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface.

So that's the categories for SDCs — and each SDC author can freely choose these. That does not yet exist. It will need to be implemented upstream (in Drupal core) in #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface (as identified in #3462705: [META] Missing features in SDC needed for XB).

There's also no built-in components.

This is a big pivot/conclusion!

There are Blocks which are exposed under "Dynamic Components".

Not stated by @lauriii but equally important: "Dynamic Components" aka Blocks also have categories, and block plugins already implement that very same interface: CategorizingPluginManagerInterface — because Block plugin authors have been able to freely choose a category for a decade now!

There is also a special category "Elements" in future which is reserved for Experience Builder. It allows XB to provide SDCs that are more close to web standards / HTML tags or design system atoms.

So the Elements category is going to be reserved, and any SDC (or block) that uses that category will not get an XB Component config entity, and will hence not be available in XB.


Rather than closing this (given: no built-in components, and no built-in categories, so in theory: nothing to do), I'd like to rescope this, to: Every XB Component config entity should have a category property.

johnwebdev’s picture

Did you link to the wrong issue?

https://www.drupal.org/project/experience_builder/issues/3482393

Is in XB, but your post suggests this is being solved upstream in core, but I couldn’t find any issue.

Edit: Nor in the meta, unless I’m just missing Things

wim leers’s picture

Title: Every XB `Component` config entity should have a `category` property » [PP-1] Every XB `Component` config entity should have a `category` property
Assigned: Unassigned » f.mazeikis
Issue summary: View changes
Issue tags: +blocker

Discussed with @lauriii and @jessebaker, they +1'd #18.

This should happen after #3475584: Add support for Blocks as Components.

Attached is a patch that provides a rough outline of how to implement this. I think @f.mazeikis is the right person to implement this after he wraps up #3475584.

@reneelund: It'd be great if you could update the issue summary to link to the findings of the various rounds of user testing 🙏

wim leers’s picture

Title: [PP-1] Every XB `Component` config entity should have a `category` property » [PP-2] Every XB `Component` config entity should have a `category` property
Issue summary: View changes
Status: Active » Postponed
wim leers’s picture

Issue tags: +Needs tests
StatusFileSize
new4.43 KB

This is an outline of what I expect this MR to look like, but given there's 2 blockers, working on an actual MR right now is premature.

wim leers’s picture

Title: [PP-2] Every XB `Component` config entity should have a `category` property » [PP-1] Every XB `Component` config entity should have a `category` property
longwave’s picture

wim leers’s picture

Title: [PP-1] Every XB `Component` config entity should have a `category` property » [PP-1] [upstream] Every XB `Component` config entity should have a `category` property
Issue tags: +Needs upstream feature

The related #3482393: HTTP API: update /xb-components to specify each `Component`'s `source` is in — this is next. But we're still blocked on #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface. We need to help land that core issue first.

longwave’s picture

Title: [PP-1] [upstream] Every XB `Component` config entity should have a `category` property » Every XB `Component` config entity should have a `category` property
Status: Postponed » Needs work

We are already extending ComponentPluginManager so if we do that in an identical way we don't need to wait for upstream.

First pass seems to work, no test coverage though.

longwave’s picture

Assigned: f.mazeikis » Unassigned
Status: Needs work » Needs review
wim leers’s picture

Assigned: Unassigned » wim leers
Issue tags: +Configuration schema, +validation
wim leers’s picture

Assigned: wim leers » longwave
Status: Needs review » Needs work

LGTM except for the config schema not matching the PHP definition of the Component config entity.

That is where test coverage is missing: a ComponentTest::testCategory() with a @testWith to test 3 possible categories should surface the bug I identified:

  • ''
  • NULL
  • 'foo'
longwave’s picture

Assigned: longwave » wim leers
Status: Needs work » Needs review

Thanks, I'm learning more about config schema from you in every MR!

wim leers’s picture

wim leers’s picture

This was AFAICT only failing due to upstream changes, not due to this MR itself. #3480805: CI: update to >=1.6.3 of the GitLab CI Template is in now, merged in origin/0.x, let's find out :)

wim leers’s picture

Assigned: wim leers » longwave
Status: Needs review » Needs work

I wanted to write the missing docs (updating docs/components.md) for you and merge this. But then I spotted something that doesn't quite add up 🙈

Actually, \Drupal\Core\Plugin\CategorizingPluginManagerTrait::processDefinitionCategory() does this:

  protected function processDefinitionCategory(&$definition) {
    // Ensure that every plugin has a category.
    if (empty($definition['category'])) {
      // Default to the human readable module name if the provider is a module;
      // otherwise the provider machine name is used.
      $definition['category'] = $this->getProviderName($definition['provider']);
    }
  }

… so category: null essentially never happens. Not for Block-sourced Components (since BlockManager uses the above trait) nor for SDC-sourced Components (since this MR is updating ComponentPluginManager to use the above trait, but using $this->t('Other') as the fallback value instead), so only for theoretical/future other component types (see #3454519: [META] Support component types other than SDC, block, and code components).

So … why exactly are we trying to support category: null in the XB Component config entity? 🤔

longwave’s picture

Assigned: longwave » wim leers

I don't understand how to work around

1) Drupal\Tests\experience_builder\Kernel\Entity\ComponentValidationTest::testRequiredPropertyValuesMissing
TypeError: Cannot assign null to property Drupal\experience_builder\Entity\Component::$category of type Drupal\Core\StringTranslation\TranslatableMarkup|string

Do we just need to override the entire method here? There doesn't seem to be a technique available in the parent testRequiredPropertyValuesMissing() to solve this; because core doesn't use types on config entity properties this doesn't seem to affect any core tests.

longwave’s picture

Status: Needs work » Needs review

Addressed #35 by making the property nullable but the config schema still disallows it.

@Wim up to you whether to do it this way or revert and fix the test instead.

wim leers’s picture

Assigned: wim leers » Unassigned
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs documentation

Arghhhhhhh that dreaded flaw in all config entities keeps causing pain 😬

Last time I ran into this: \Drupal\experience_builder\Entity\Pattern::$component_treePattern config entities MUST have a component tree, but due to the way config entities work, the only choice we have is: make a required config entity property nullable at the PHP class level, while making it required at the config schema level. 😬

So I'm 90% happy with what you did here, the only change I want to make is that the ::getCategory() method cannot ever return NULL — because all of XB's config entities are validated, and validation would have caught the absence of a category thanks to the config schema!

Tada: what we want and need, but in a less-than-ideal (yet pragmatic) fashion.

Did that.

Also added the missing docs.

  • wim leers committed ea103bae on 0.x authored by longwave
    Issue #3459088 by wim leers, longwave, lauriii, reneelund, larowlan:...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.