I want to use config function in XML file to render the phtml file same as below that we use in magento 1.x.x

<reference name="root">
    <action method="setTemplate" ifconfig="mymodule/general/enabled"><template>page/1column.phtml</template></action>

How can I do it on magento2.

I have created my config function in helper and want to use these function to render the phtml, based on configuration setting.


1 Answer 1


We can use something like below in Magento2:

<block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="contact/contact/enabled" name="contact-us-link">

Let me know if its helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.