Magento2开发教程NO20-后台模块开发示范实例

Magento2后台模块moudule其实很简单,可以参考已有的代码,规范写法,就可以开发出自己想要的功能模块,这里给一个基本的后台模块开发示范实例:

  • To add a menu/sub-menu, check out the following files:
    • etc/adminhtml/menu.xml
    • etc/adminhtml/routes.xml
  • To bind a page to those submenus, check out the following files:
    • You will notice the path to look like the action parameter from etc/adminhtml/menu.xml
    • Controller/Adminhtml/SampleOne/Index.php
    • Controller/Adminhtml/SampleTwo/Index.php
  • To add content to your freshly created pages, check out the following files:
    • view/adminhtml/layout/adminsample_sampleone_index.xml
    • view/adminhtml/templates/sample/one.phtml
  • To add content to your freshly created pages and pass something to it, You can also check:
    • view/adminhtml/layout/adminsample_sampletwo_index.xml
    • Controller/Adminhtml/SampleTwo/Index.php
    • view/adminhtml/templates/sample/two.phtml
  • To set and retrieve values from Magento2’s configuration you can check these files:
    • Controller/Adminhtml/SampleTwo/Index.php
    • etc/adminhtml/system.xml Configuration menu in Stores/Settings/Configuration is set here
    • etc/config.xml Default configuration
    • view/adminhtml/templates/sample/two.phtml
  • To see how ACLs are made, check these files:
    • etc/acl.xml
    • You’ll notice that most resource elements are from etc/adminhtml/menu.xml
  • To see how to have different layouts, check this file:
    • view/adminhtml/layout/adminsample_sampletwo_index.xml
  • To see how we create a custom block and use it, check those files:
    • Block/Adminhtml/CustomBlock.php
    • view/adminhtml/layout/adminsample_sampletwo_index.xml
  • To see how you use block functions, have a look at:
  • Block/Adminhtml/CustomBlock.php
    • view/adminhtml/templates/custom/one.phtml
  • To call a helper from a block you can check:
    • Block/Adminhtml/CustomBlock.php
    • Helper/ConfigHelper.php
    • view/adminhtml/templates/custom/one.phtml

GitHub官网下载 网盘下载

郑重声明:

1 本资源来源于互联网,资源的版权归资源原作者所持有,受《中华人民共和国著作权法》等相关法律保护。

2 由于无法和原作者取得联系,所以上传的部分资源无法先通过原作者的同意就分享给大家了,如本资源侵犯了您(原作者)的权益,请联系我们(微信号 xiaohaimei1989),我们会立马删除您的资源,并向您表达诚挚的歉意!

3 本站是一个公益型网站,分享资源的目的在于传播知识,分享知识,收取一点点打赏的辛苦费是用于网站的日常运营开支,并非用于商业用途。

4 本站资源只提供学习和参考研究使用,使用过后请在第一时间内删除。本站不承担资源被单位或个人商用带来的法律责任。

发表评论