Hi !
When using single directory components, I cannot render them in ui_examples. It seems thats props and slots get prefixed with # in ExampleSyntaxConverter, preventing them from being rendered properly.
Edit : here's a sample of the yaml for the rendered elements :
render:
- type: html_tag
tag: 'h1'
value: 'Title'
- type: component
component: 'theme_name:button'
props:
type: primary
title: ''
tag:
text: 'Link title
url: 'https://www.link-url.com'
target: '_blank'
I found a workaround for this, by adding this piece of (untested) code :
# ExampleSyntaxConverter.php:59
protected function convertRenderArray(array $renderable): array {
foreach ($renderable as $property => $value) {
if (in_array($property, ['props', 'slots'])) {
continue;
}
// ...
}
// ...
}
Have I missed something ? If not, I'll submit a MR with said changes.
Thanks,
Comments
Comment #2
jmaxant commentedComment #3
jmaxant commentedComment #4
pdureau commentedIt may be because of
type: primarywhich is part of::RENDER_KEYSyou are proposing to skip both slots and props but may be more complicated (and indirectly related to this Core issue: #3494634: Compatibility between SDC and the Form API)
I will do a little test
Comment #6
pdureau commentedHi Grimreaper,
This is the opportunity of reoganizing our logic: https://git.drupalcode.org/project/ui_examples/-/merge_requests/21/diffs
The MR is not tested and is a bit too verbose and clunky, I will finish the job, but it is a good base for discussion for us.
(Let's not forget this logic must be duplicated in UI Patterns 2, so let's keep it lean).
(Is it the opportunity of supporting
#theme => table?)Comment #7
pdureau commentedComment #9
grimreaperComment #10
grimreaperComment #11
grimreaperMR updated regarding MR in UIP
Comment #12
pdureau commented