0

How do you hide a default magento 2 config section in the backend (Admin Panel)? For example I want to hide the "Mail Sending Settings" section located in Stores->Configuration->Advanced->System

This is what I tried so far but it's not working:

composer.json

{
"name": "vendor/module_name",
"description": "SMTP Extension for Magento 2 to help the configuration of the SMTP (Simple Mail Transfer Protocol) server.",
"type": "magento2-module",
"version": "1.0.0",
"require": {
    "php": "~5.6.5|7.0.2|7.0.4|~7.0.6",
    "magento/framework": "100.1.*",
    "magento/magento-config": "100.1.*" 
},
"license": [
    "proprietary"
],
"minimum-stability": "stable",
"autoload": {
    "psr-4": {
        "Vendor\\Module_Name\\": ""
    },
    "files": [
        "registration.php"
        ]
    }
}

registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'vendor_module_name',
    __DIR__
);

etc/system.xml

<?xml version="1.0" encoding="utf-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="system">
            <group id="smtp" showInDefault="0" showInWebsite="0" showInStore="0">
            </group>
        </section>
    </system>
</config>

etc/module.xml

<?xml version="1.0" encoding="utf-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="vendor_module_name" setup_version="1.0.0">
    </module>
</config>

PS: My cache is disabled and my Magento 2 installation is in developer mode.

0

After some trials and errors I finally figured why it wasn't working. The file system.xml was misplaced into the wrong folder. system.xml needs to be placed under etc/adminhtml/system.xml and NOT under etc/system.xml.

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.