When using props keys: 'tag', 'type', 'attributes', 'value', 'attached', they are interpreted as $html_tag_allowed_render_keys in the function convertRenderArray function of StoriesSyntaxCpnverter.
To pevent this, we should exclude the element props, from being converted.

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

kensae created an issue. See original summary.

kensae’s picture

Title: Prevent prop s keys to be transformed in render array keys with # in StoriesSyntaxConverter » Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter
pdureau’s picture

Status: Active » Needs review

Thanks you so much Kensae, your solution is very pragmatic, targeting exactly where the issue here in SDC prop conversion.

However, we are currently facing a similar issue in UI Example module: #3505217: Support render arrays using render properties as render children and I would address to address both:

  • in a more generic way, because the root cause is the wrong sue of render children by SDC
  • in a similar way in both module

So, I let this in review state for now.

grimreaper’s picture

Assigned: Unassigned » grimreaper
Status: Needs review » Needs work
grimreaper’s picture

grimreaper’s picture

Assigned: grimreaper » pdureau
Status: Needs work » Needs review
grimreaper’s picture

Issue tags: +ddd2025
pdureau’s picture

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

Do we need tests mixing #-prefixed properties and not already #-prefix properties?

Data:

       '#type' => 'component',
        'component' => 'ui_suite_daisyui:card',
        '#slots' => []

Expected:

        '#type' => 'component',
        '#component' => 'ui_suite_daisyui:card',
        '#slots' => []

Data:

       'type' => 'component',
        'component' => 'ui_suite_daisyui:card',
        '#slots' => []

Expected:

        '#type' => 'component',
        '#component' => 'ui_suite_daisyui:card',
        '#slots' => []

Data:

       '#type' => 'html_tag',
        'tag' => 'p',
        'anything' => []

Expected:

       '#type' => 'html_tag',
        '#tag' => 'p',
        'anything' => []

And also, some tests about #theme: layout which is the reason why we started this work.

pdureau’s picture

Title: Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter » [2.0.4] Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter
grimreaper’s picture

Title: [2.0.4] Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter » Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter
Assigned: grimreaper » pdureau
Status: Needs work » Needs review

MR updated.

  • pdureau committed eb8ea0b4 on 2.0.x authored by kensae
    Issue #3515500 by grimreaper, kensae, pdureau: Prevent element props...
pdureau’s picture

Title: Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter » [2.0.4] Prevent element props keys to be transformed in render array keys with # in StoriesSyntaxConverter
Assigned: pdureau » Unassigned
Status: Needs review » Fixed
pdureau’s picture

Status: Fixed » Closed (fixed)