mvbmvb MemberComments: Received thanks: 0 Member since: May 22

Hi,

I want to use some components (https://component-library.shopware.com/components/sw-label/) in the backend.

But I don't know it this is possible if you don't can't set the value (or how to fill a slot).

For example I want to use the sw-label, to add some extra visible description text inside a card section (not hidden using a helpText).
I can set all the variables like variant, but not the: "lorem ipsum dolor sit amet" text.

<sw-label size="default" appearance="default" :ghost="false" :caps="false">
    Lorem ipsum dolor sit amet
</sw-label>

custom/plugins/x/src/Resources/config/config.xml

<card>
    <title>X</title>
    <component name="sw-label">
      <name>testLabel</name>
      <variant>danger</variant>
      <value>lorem ipsum dolor sit amet don't work</value>
      <default>lorem ipsum dolor sit amet don't work</default>
      <defaultValue>lorem ipsum dolor sit amet don't work</defaultValue>
      <label>lorem ipsum dolor sit amet don't work</label>
    </component>
</card>

What I can do is create my own custom-label component and use that, but there are many other components that needs a value to work.

When I open this file: vendor/shopware/platform/src/Administration/Resources/app/administration/src/app/component/base/sw-label/sw-label.html.twig

{% block sw_label %}
    <span class="sw-label" :class="labelClasses" @click.stop="$emit('selected')">
        {% block sw_label_text_holder %}
            <span class="sw-label__caption">
                <slot>{% block sw_label_slot_default %}{% endblock %}</slot>
            </span>
        {% endblock %}

        ...
    </span>
{% endblock %}

You can see a slot is used for the value.
But I don't know how to use that, using config.xml

Sign In or Register to comment.