1

I have a custom module.I created the my account page menu and page.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="customer_account_navigation">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-rewardpoints-link" after="-">
            <arguments>
                <argument name="path" xsi:type="string">rewardpoints</argument>
                <argument name="label" xsi:type="string">My Reward Points</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

I want to to show the menu when the module is enable from the back end.

$enable = $this->helper('Eight25media\Rewardpoints\Helper\Data')->getGeneralConfig('rrpoints/enable');

I can check from my controller to remove the page but my question is how to remove in my account page left side menu section?.

3
  • 3
    You can use ifconfig in block to check your module is enabled or not Commented Sep 26, 2017 at 6:16
  • Thank you.can you explain more please?
    – Mujahidh
    Commented Sep 26, 2017 at 6:18
  • 1
    Check @keyur answer you can use ifconfig="section/group/field" as your system.xml Commented Sep 26, 2017 at 6:37

2 Answers 2

3

You can use ifconfig feature as commented by @Prince, like

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="customer_account_navigation">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-rewardpoints-link" after="-" ifconfig="ADD/YOUR/ACTIVE">
            <arguments>
                <argument name="path" xsi:type="string">rewardpoints</argument>
                <argument name="label" xsi:type="string">My Reward Points</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

In ifconfig you can add your module config condition. like ifconfig="section/general/active"

0
2

You can check ifconfig in your layout using below code

<block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="your_section/group/field" name="customer-account-navigation-rewardpoints-link" >
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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