Hatte mit der Anleitung ab dem Part Storefrontauch ein bisschen zu kämpfen. Insbesondere da ich einen anderen Namen für den Block vergeben habe, als in der Anleitung.
Hier also noch meine Ergänzung, falls sich jemand fragt, warum sein Storefront twig nicht angezogen wird:
Der Name der Storefront Twig muss wie folgt lauten:
cms-block-name*DesBlocksWieErInDerIndex.jsDefiniertWurde*.html.twig
Ich hatte noch Issues mit der Ausgabe und habe sichergestellt, dass der Block im Twig-File dem aus dem components-Twig File entspricht.
…/src/Resources/app/administration/src/module/sw-cms/blocks/text-image/four-images-with-text/index.js
import './component';
import './preview';
Shopware.Service('cmsService').registerCmsBlock({
name: 'four-images-with-text',
category: 'text-image',
label: 'Four Images with Text!',
component: 'sw-cms-block-four-images-with-text',
previewComponent: 'sw-cms-preview-four-images-with-text',
defaultConfig: {
marginBottom: '20px',
marginTop: '20px',
marginLeft: '20px',
marginRight: '20px',
sizingMode: 'boxed'
},
slots: {
leftTop: 'image',
leftBottom: 'text',
leftCenterTop: 'image',
leftCenterBottom: 'text',
rightCenterTop: 'image',
rightCenterBottom: 'text',
rightTop: 'image',
rightBottom: 'text'
}
});
…/src/Resources/app/administration/src/module/sw-cms/blocks/text-image/four-images-with-text/component/sw-cms-block-sw-cms-block-four-images-with-text.html.twig
{% block sw_cms_block_four_images_with_text %}
<div class="sw-cms-block-four-images-with-text-row">
<div>
<slot name="leftTop">{% block sw_cms_block_four_images_with_text_slot_leftTop %}{% endblock %}</slot>
<slot name="leftBottom">{% block sw_cms_block_four_images_with_text_slot_leftBottom %}{% endblock %}</slot>
</div>
<div>
<slot name="leftCenterTop">{% block sw_cms_block_four_images_with_text_slot_leftCenterTop %}{% endblock %}</slot>
<slot name="leftCenterBottom">{% block sw_cms_block_four_images_with_text_slot_leftCenterBottom %}{% endblock %}</slot>
</div>
<div>
<slot name="rightCenterTop">{% block sw_cms_block_four_images_with_text_slot_rightCenterTop %}{% endblock %}</slot>
<slot name="rightCenterBottom">{% block sw_cms_block_four_images_with_text_slot_rightCenterBottom %}{% endblock %}</slot>
</div>
<div>
<slot name="rightTop">{% block sw_cms_block_four_images_with_text_slot_rightTop %}{% endblock %}</slot>
<slot name="rightBottom">{% block sw_cms_block_four_images_with_text_slot_rightBottom %}{% endblock %}</slot>
</div>
</div>
{% endblock %}
…/src/Resources/views/storefront/block/cms-block-four-images-with-text.html.twig
{% block sw_cms_block_four_images_with_text_slot_leftTop %}
{% set element = block.slots.getSlot('leftTop') %}
{% set elementText = block.slots.getSlot('leftBottom') %}
...
{{ elementText.data.content | sw_sanitize }}
...
{% endblock %}