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):
- components that are provided by the default theme end up in the Library on the left-hand side, because this is the majority use case
- Elements, which are XB-provided low-level, HTML tag-like components (see @lauriii's description in #17, to be refined in #3455036: Clarify "components" vs "elements" vs "patterns")
- Components that are provided by modules end up in the Extensions dropdown in the top bar (SDCs only)
- Dynamic Components dropdown (that should currently only list Blocks Plugins — once #3475584: Add support for Blocks as Components lands — more may follow later in #3454519: [META] Support component types other than SDC, block, and code components)
(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:
- Library (default theme-provided SDCs): each SDC defines its own category — blocked on #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface
- Extensions (module-provided SDCs): each SDC defines its own category — blocked on #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface
- 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
SystemMenuBlockhas
category: new TranslatableMarkup("Menus"),
Proposed resolution
- Store that category in the XB
Componentconfig entity - … but only if the category is not
Elements— unless the provider is the XB module itself. IOW:Elementsis a reserved category - Expose the
categoryof eachComponentviaApiComponentsControllerto the client - Update
/openapi.ymlaccordingly
User interface changes
This will unblock the following UI/UX: https://www.figma.com/design/1sj0mnVdLFdYihrkAhR43u/Experience-Builder-%...
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | 3459088-outline.patch | 4.43 KB | wim leers |
Issue fork experience_builder-3459088
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
Comment #2
lauriiiComment #3
wim leersWhat 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.
Comment #4
lauriiiI'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.
Comment #5
wim leersComment #6
lauriiiWe are planning to launch a research utilizing unmoderated interviews + tree testing next Monday.
Objectives
Users/Participants
We can target the following groups on PlaybookUX:
Personas:
Target Markets:
Comment #7
lauriiiAdding a link to Figma which has a benchmark + a hypothesis to test: https://www.figma.com/board/PtSgs0OuOaU1uwpstivpmM/Benchmark?node-id=0-1....
Comment #9
wim leersThis 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:
Lee confirms the need for this based on real-world experience with Layout Builder 👍
Comment #10
wim leersMatching the issue title prefix pattern I used for #3455036: Clarify "components" vs "elements" vs "patterns".
Comment #11
wim leersIIRC @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 ?
Comment #12
kristen polI 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?
Comment #13
reneelund commentedComment #14
reneelund commentedThis is in progress, I am getting this issue ready for handoff for next weeks call!
Comment #15
wim leers🥳
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.)
Comment #16
kristen polVery excited to see the designs!
Comment #17
lauriiiThere 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.
Comment #18
wim leersThis will be implemented in #3482393: HTTP API: update /xb-components to specify each `Component`'s `source`.
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).
This is a big pivot/conclusion!
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!So the
Elementscategory 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
Componentconfig entity should have acategoryproperty.Comment #19
johnwebdev commentedDid 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
Comment #20
wim leersDiscussed 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 🙏
Comment #21
wim leersComment #22
wim leersThis 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.
Comment #23
wim leers#3475584: Add support for Blocks as Components is in.
Comment #24
longwaveAdded some comments and an alternative approach to #3474533: ComponentPluginManager must implement CategorizingPluginManagerInterface
Comment #25
wim leersThe 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.
Comment #27
longwaveWe 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.
Comment #28
longwaveComment #29
wim leersComment #30
wim leersLGTM except for the config schema not matching the PHP definition of the
Componentconfig entity.That is where test coverage is missing: a
ComponentTest::testCategory()with a@testWithto test 3 possible categories should surface the bug I identified:''NULL'foo'Comment #31
longwaveThanks, I'm learning more about config schema from you in every MR!
Comment #32
wim leersComment #33
wim leersThis 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 :)Comment #34
wim leersI 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:… so
category: nullessentially never happens. Not forBlock-sourced Components (sinceBlockManageruses the above trait) nor forSDC-sourced Components (since this MR is updatingComponentPluginManagerto 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: nullin the XBComponentconfig entity? 🤔Comment #35
longwaveI don't understand how to work around
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.Comment #36
longwaveAddressed #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.
Comment #37
wim leersArghhhhhhh that dreaded flaw in all config entities keeps causing pain 😬
Last time I ran into this:
\Drupal\experience_builder\Entity\Pattern::$component_tree—Patternconfig 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.
Comment #39
wim leers