Somehow i only found about this little gem only recently. In your layout xml you can use the ifconfig
parameter to hide or show block depending on your configuration. It works as following:
<block class="<VENDOR><MODULE>BlockMyBlockClass" ifconfig="vendor_module/group/configuration_option" name="my-block" />
Now when you make sure the config path vendor_module/group/configuration_option
exists, Magento will check the value for you. If it is true-ish you block will be shown, if not it will hide the block.
Hey, I'm running a developer focussed newsletter called MageDispatch.com, which is for the community and by the community. Here you can share links that you think that the community should know about. If you like this kind of technical content you will like this newsletter too.
Documentation
I tried to find documentation about this, but on the Magento devdocs website this keyword is not found. I have found some usages in the core though so my guess is that it's safe to use:
Want to respond?