2

Created folders and added code for the custom module but nothing gonna work in my way please help, nothing shown up in the admin panel. Here's my code and folders that I created:

public_html/testing2/app/code/Test

public_html/testing2/app/code/Test/Banners

public_html/testing2/app/code/Test/Banners/registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

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

/home1/dukaania/public_html/testing2/app/code/Test/Banners/composer.json

{
    "name": "test/banners",
    "description": "Test Banner For test",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/framework": "100.0.*"
    },
    "type": "magento2-module",
    "version": "1.0.0",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ],
        "psr-4": {
            "Test\\Banners\\": ""
        }
    }
}

/home1/dukaania/public_html/testing2/app/code/Test/Banners/etc/module.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Test_Banners" setup_version="2.0.0">

    </module>
</config>

what steps I would take to show this module in the admin panel?

  • Hey John, you didn't add any feature to be displayed.. What exactly you are trying to do/add? Can you check if It is showing under setup_module table in configured database? – Himmat Paliwal Sep 22 '18 at 10:23
  • yes its showing there – jhon jhon doe Sep 22 '18 at 11:29
1

As per your question you just have added module file which requires it to run. So when you run module:enable it will just enable your module. But right now there is nothing to execute in your module.

So to add you module in admin, you need to add menu.xml in etc/adminhtml/menu.xml and there you need to define your menu and action path for menu.

And this way you need to add controller, block, layout, ui_component and template as per your need. here you can find detailed information for creating menu and other essential things.

  • hello, m created menu.xml file as well and run php -f bin/magento cache:clean command but nothing still shown in admin panel. – jhon jhon doe Sep 22 '18 at 11:25
  • Then you must be missing small thing please check that link. – Kumar M Sep 22 '18 at 11:51
  • module add successfully now I want to add some customization in that page, So I need to add new pages for showing data? – jhon jhon doe Sep 22 '18 at 12:01
  • Is that page is Magento default or you want to add your own thing ? If you want to add your own thing then please do Google "create admin grid and form in Magento 2" you will get some results that will explain you how to develop it. – Kumar M Sep 22 '18 at 12:19
  • And please upvote my answer – Kumar M Sep 22 '18 at 12:20
1

Can you add menu.xml with below code:

<?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"> <menu> <add id="Vendor_Module::test" title="Test Title" module="Vendor_Module" sortOrder="50" parent="Magento_Backend::marketing" resource="Vendor_Module::test" /> <add id="Vendor_Module::test_child" title="Settings" module="Vendor_Module" sortOrder="3" action="set action here" parent="Vendor_Module::test" resource="Vendor_Module::test_child"/> </menu> </config>

Update Vendor_Module with your module name and check if it adds a menut under Marketing tab..

  • yes: <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"> <menu> <add id="Banner_id::first_level_demo" title="Banner First Level" module="Banner_MenuItem" sortOrder="9999" resource="Magento_Backend::content" /> </menu> </config> – jhon jhon doe Sep 22 '18 at 11:39

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.