Magento – how to call function(Helper) from xml in magento

conditional-loadinghelperlayoutmagento-2.1

i see this post

I want to do the same but with a condition. I want to call an helper function which return a boolean. And in my xml do like :

    <?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="ajax-empty" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="root">
            <block class="Magento\Framework\View\Element\Template" name="customer.account.popin" template="MyVendor_Customer::form/popin_disconnected_content.phtml">
                IF USER IS LOGGED IN
                    <block class="Magento\Framework\View\Element\Messages" name="messages"/>
                    <block class="Magento\Customer\Block\Form\Login\Info" name="customer.account.popin.register" template="Magento_Customer::newcustomer.phtml"/>
                    <block class="Magento\Customer\Block\Form\Login" name="customer.account.popin.login" template="Magento_Customer::form/login.phtml">
                        <block class="Magento\Persistent\Block\Form\Remember" name="remember_me" template="Magento_Persistent::remember_me.phtml" ifconfig="persistent/options/enabled" as="form_additional_info"/>
                    </block>
                END
                IF USER IS NOT LOGGED IN
                    <block class="Magento\Customer\Block\Form\Login\Info" name="customer.account.popin.register" template="Magento_Customer::newcustomer.phtml"/>
                MORE CONTENT WILL BE ADD HERE
                END
            </block>
        </referenceContainer>
    </body>
</page>

How can I do this ?

EDIT : this is like I want to do but it's with observers and I'm too weak with magento 2 config to change it for helpers, can you help me please ?

Best Answer

Please, refer to this link, http://inchoo.net/magento/custom-layout-update-handles/. It could help you. Use the following to call a function from Helper inside layout.

 <action method="setStorVar">
<var helper="module/getStoreVar" />