Problem/Motivation

Once POC fixed the bug, I can't reproduce the bug when stashing my changes.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

Grimreaper created an issue. See original summary.

grimreaper’s picture

Assigned: grimreaper » Unassigned
Status: Active » Postponed

MR created, but let's wait if I or someone else manage to reproduce the bug.

pdureau’s picture

Assigned: Unassigned » pdureau
Status: Postponed » Needs work

I will have a look

pdureau’s picture

Assigned: pdureau » grimreaper

@grimreaper, OK with that? If yes, let's ask Steven to review and to confirm the usefulness of such a change.

grimreaper’s picture

Assigned: grimreaper » pdureau

Ok with the change.

But PHPMD and PHPStan also caught what I saw in my code review ;)

pdureau’s picture

Sorry for this stupid mistake. I have amended the commit.

The work may not be not over anyway:

Steven - Today at 1:48 AM
unfortunately still seems broken without ui devel
May be related but is the LinksPropType normalize suppose to turn the attributes into an array vs a Drupal Attribute object?
Pierre - Today at 7:49 AM
indeed. It was necessary a few month ago because we were running normalize before SDC validator, but it seems we are now running it after SDC validator, so we may be able to remove this part.

So, I will test that

pdureau’s picture

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

2 big changes:

1

I have added Steven's example to the test cases and I understood the normalization of link_attributes was not happenig at the right place.

Preventing the possibility of defining link_attributes manually in presenter templates:

      [
        "title" => 0,
        "url" => "?page=0",
        "attributes" => new Attribute(),
        "link_attributes" => new Attribute([
          'class' => [
            'display-flex',
            'flex-align-center',
            'flex-no-wrap',
          ],
        ]),
      ]

https://git.drupalcode.org/project/ui_patterns/-/merge_requests/166/diff...

2

I have improved the management of link_attributes by merging existing values with the ones extracted from the Url objects.

And I removed the transformation of Attribute objects to arrays, because SDC is not complaining anymore about that. Maybe because PropTypeInterface::normalize() now happens after the SDC validator is run.

https://git.drupalcode.org/project/ui_patterns/-/merge_requests/166/diff...

pdureau’s picture

Status: Needs review » Fixed

  • pdureau committed 53471f68 on 2.0.x authored by Grimreaper
    Issue #3465453 by pdureau, Grimreaper, smustgrave: Validation errors...
pdureau’s picture

Status: Fixed » Closed (fixed)