2

I have an XML layout file, specifically customer_account_login.xml, which is processed automatically by Magento and replaces the out-of-the-box copy.

In some cases I would like to do this, while in others I want the out-of-the-box file (based on backend configuration).

I have not found a way to turn off processing for my XML file under certain conditions, but assume there is some class that can be overridden to do this. A generic way would be preferable, but I could live with a method that toggles just this specific XML file.

To clarify: the question is about avoiding processing the XML file entirely, not how to conditionally show/hide certain blocks and other layout elements.

0

You can use ifconfig parameter on your node to enable/disable it on the basis of value of a specified field in system configuration [system.xml].

You can specify the field from system.xml by mentioning ifconfig="section/group/field" from your system.xml. Preferably keep the field to be a select of yes/no type.

Feel free to ask any queries in case of confusion.

  • Thanks, but this is not really what I am after. ifconfig only works with blocks, which is problematic (try containers), and it's also more difficult to remove elements (can be done with action but not in all cases, and requires a convoluted structure). The biggest problem however, is the fact that the file needs to be processed at all, I'd like for it to be completely ignored in some cases. – Ynhockey Aug 22 '18 at 15:12
  • 1
    As far as if know ifconfig is the only condition processing in layout xmls of magento. Please do post the answer here if you find anything else. – Vivek Kumar Aug 22 '18 at 15:14

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.