- Issue created by @pixelwhip
- πΊπΈUnited States agentrickard Georgia (US)
I was just able to do this in a story file, which solves a similar issue where drupal render attributes are not present.
first: { visible: false, attributes: create_attribute(), },
I wonder if we can make a simple:
create_markup()
Twig extension and acreate_render_array()
for the complex case in β¨ Story representation of Drupal render arrays Active - πΊπΈUnited States themarkahrens
We are running into a similar situation where our component takes in a Drupal media entity for an image, so in the story, we are trying to pass an img tag as the content for an argument. However, when the story is rendered, Storybook is showing the img tag text instead of rendering the image.
- πΊπΈUnited States agentrickard Georgia (US)
I think the temporary solution for that render problem may be to use Twig blocks and embed to pass changes from the story file, but I am not thrilled by that option.
e.g -- twig render template (template.twig)
<% block image %> {{ image }} <% endblock %> -- story implementation <code> {% story my_story with { name: 'My story, image: '<img src="this.png"/>` } %} {% embed template.twig %} {% block image %} {{ image|raw || {% endblock %} {% endembed %} {% endstory %}
- πΊπΈUnited States liberatr Portland, OR
I currently need to wrap all of the content in a "normal" drupal twig file in a block, or storybook won't print it out.
At least as far as I can tell.
It's a little repetitive.
- πΊπΈUnited States cosmicdreams Minneapolis/St. Paul
I'm trying to follow along here because I was considering creating a new ticket but this one sounds a lot like my issue.
I'm trying to create a story that works with Storybook's arguments / controls. I can get a simple argument to work, but I can't get an argument that works with a slot to work.
I'm eager to see an example that demonstrates it's possible.