Slot.Has

Adds a condition that is verified if a slot has been defined with the ViewHelper “Slot”.

This ViewHelper is useful when used inside a field layout (see chapter “Layouts”).

Important

This ViewHelper must be used inside a ViewHelper “Field”.

Note

This ViewHelper can be used the same way <f:if> is used; it means <f:then> and <f:else> will work normally.

Arguments

Argument Description
* slot Name of the slot that will determine the rendering of the block.

Examples

1
2
3
4
5
6
7
8
9
{namespace fz=Romm\Formz\ViewHelpers}

<div class="container">
    <fz:slot.has slot="Image">
        <div class="image">
            <fz:slot.render slot="Image" />
        </div>
    </fz:slot.has>
</div>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{namespace fz=Romm\Formz\ViewHelpers}

<div class="container">
    <fz:slot.has slot="Image">
        <f:then>
            <fz:slot.render slot="Image" />
        </f:then>
        <f:else>
            <img src="default-image.jpg" />
        </f:else>
    </fz:slot.has>
</div>