Displaying examples for slots

Created on 27 November 2023, about 1 year ago

Problem/Motivation

Thanks for this module. I'm currently looking for a way to display examples for slots, but I cannot find any documentation regarding this.
Is it something currently supported by the module?

💬 Support request
Status

Active

Version

1.0

Component

Documentation

Created by

🇦🇺Australia elgandoz Canberra

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @elgandoz
  • 🇫🇷France Quentin Harelle

    At the moment I did not try to use slots in the .components.yml for the moment, but you should be able to access the data in your component anyway in theory.

    I'll try to look into it when I'll have the time.

  • 🇦🇺Australia elgandoz Canberra

    I can access the examples of the slots, eg: $pluginDefinition['slots'][$slot_name]['examples'][0], but ATM I don't know how to render twig blocks in dab/src/Controller/DabComponentController.php: $markup = $this->twig->renderInline($twigTemplate, $variables);

  • 🇫🇷France Quentin Harelle

    Hi elgandoz,

    Sorry for the very long response time ...

    I looked into it, and I was not working with the slots at all ...

    If you still have the issue you can test it with the patch that I provide you and this working example to put in a component.yml file :

    slots:
      test:
        description: 'The title content.'
        examples:
          - '<p>Title content</p>'
          - '<p>Another title <span>content</span></p><ul><li>Item 1</li><li>Item 2</li></ul>'
    

    And in a twig file :

      {% block test %}
        {{ test }}
      {% endblock %}
    

    Theses examples will be converted into Markup and can then be printed into the twig template.

  • 🇫🇷France Quentin Harelle

    Will be shipped with the 1.0.9 fix version.

Production build 0.71.5 2024