XF 2.0 Switch overlay & HTML in replacement

Lukas W.

Well-known member
Trying to make HTML in the switch overlay replacement string working. Any way to get this done? Current markup is:
HTML:
                    <a href="{{ link('forums/watch', $node.Data) }}"
                       data-xf-click="switch-overlay"
                       data-sk-watch="<i class='fa fa-eye-slash'></i>"
                       data-sk-unwatch="<i class='fa fa-eye'></i>">
                        <xf:if is="{$node.Data.Watch.{$xf.visitor.user_id}}">
                            <i class="fa fa-eye-slash"></i>
                            <xf:else />
                            <i class="fa fa-eye"></i>
                        </xf:if>
                    </a>

But that inserts unrendered/escaped HTML:
4dWR3VH.png
 
Figured this out:
HTML:
                    <a href="{{ link('forums/watch', $node.Data) }}"
                       data-xf-click="switch-overlay"
                       data-sk-watch="addClass:fa-eye,removeClass:fa-eye-slash,"
                       data-sk-unwatch="addClass:fa-eye-slash,removeClass:fa-eye,"
                       class="fa fa-eye{{ $node.Data.Watch.{$xf.visitor.user_id} ? '-slash' : ''}}">
                    </a>
 
Figured this out:
HTML:
                    <a href="{{ link('forums/watch', $node.Data) }}"
                       data-xf-click="switch-overlay"
                       data-sk-watch="addClass:fa-eye,removeClass:fa-eye-slash,"
                       data-sk-unwatch="addClass:fa-eye-slash,removeClass:fa-eye,"
                       class="fa fa-eye{{ $node.Data.Watch.{$xf.visitor.user_id} ? '-slash' : ''}}">
                    </a>
This helped me out so much.

Thanks!!!
 
Back
Top Bottom