Problem/Motivation

#3390712: Add component variants to SDC was merged in Core and will be shipped with 11.2

Proposed resolution

Is it compatible with our own variant system ?

API changes

We are still supporting Drupal 10.3+ so this issue will not be the opportunity of removing our own impelmnattion and any change we do must be compatible with Drupal 10.3+

CommentFileSizeAuthor
#2 drupal - UI patterns - 3522873.png13.84 KBsharique
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.

sharique’s picture

StatusFileSize
new13.84 KB

I did the quick testing for this as follows.

  • Installed latest Drupal core 11.x
  • Create a new theme
  • Created a simple alert component
  • Installed UI pattern layout and layout builder
  • Added alert component in article display mode using layout builder twice with different variants
  • Both variants are displayed correctly.

There is one error I got when enabling module, I'll create a separate ticket for it

smovs’s picture

Status: Active » Reviewed & tested by the community

Thank you @sharique, for testing and your feedback.

I tested it a bit as well, and here are my results:
Tested env:
Crupal Core: 11.2-dev
PHP: 8.3.19
UI Patterns: 2.0.3

During the installation of the ui_patterns 2.0.3, I got an error about the compatibility with the Drupal Core implementation (ComponentPluginManager::processDefinitionCategor)

Also, I installed and tested these themes as origins for the components :
ui_suite_bootstrap (5.1.0-beta1)
ui_suite_material (2.0.0-beta1)
ui_suite_daisyui (5.0.0-alpha2)

Each of them was installed and worked without errors.

I can confirm variants like primary, danger, warning, etc., from the abovementioned themes work without issues in Drupal 11.2.

pdureau’s picture

Status: Reviewed & tested by the community » Fixed

Great, thanks both.

ComponentPluginManager::processDefinitionCategory is managed in an other issue: #3506207: [2.0.4] PHPSTAN next minor warnings

grimreaper’s picture

Title: [2.0.5] Test the SDC Variants of Drupal 11.2 » [2.0.4] Test the SDC Variants of Drupal 11.2
pdureau’s picture

Status: Fixed » Closed (fixed)
pdureau’s picture

Assigned: Unassigned » grimreaper
Status: Closed (fixed) » Needs work

Grimreaper has found something !

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Needs work » Needs review

We encountered:

Drupal\Core\Render\Component\Exception\InvalidComponentException: [props.properties.variant.enum] There must be a minimum of 1 items in the array, 0 found in Drupal\Core\Theme\Component\ComponentValidator->validateDefinition() (line 144 of core/lib/Drupal/Core/Theme/Component/ComponentValidator.php).

In vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.php:

    public function resolveRef(string $ref, $resolveStack = [])
    {
        ...
        // get & process the schema
        $refSchema = $this->getSchema($fileName);
        foreach ($jsonPointer->getPropertyPaths() as $path) {

$jsonPointer->getPropertyPaths() is empty and $refSchema = $this->getSchema($fileName); get empty enum.

Removing special $ref for variant fixes the problem. Somehow no problem with other special $ref of UI Patterns 2.

  • pdureau committed 1475475e on 2.0.x authored by grimreaper
    Issue #3522873 by pdureau, grimreaper: Compatibility with Drupal 11.2's...
pdureau’s picture

Title: [2.0.4] Test the SDC Variants of Drupal 11.2 » [2.0.5] Compatibility with Drupal 11.2's SDC Variants
Status: Needs review » Fixed

that was a weird one, but i have merged

Status: Fixed » Closed (fixed)

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