php - Correct way of app/design and app/code usage Magento 2 Adminhtml -
i wish understand 2 things:
- extend magento 2 admin css ( or correct way doing less?) copy css/less original back-end
- override in back-end example : sales > orders > called file vendor/magento/module-backend/view/adminhtml/templates/pageactions.phtml
i have followed http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/admin_theme_create.html & http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/admin_theme_apply.html
checked different stackoverflow posts like
magento 2.0 override admin css (style.css)
but i'm @ loss @ moment understanding correctly.
i wish override css magento login example. when use app/code, , when use app/design , reasons? in example i'm trying both , i'm not sure place reason. posts refer overriding through app/code, app/design css change works too, correct?
i succesful in creating custom page backend, through module activate custom adminhtml template through di.xml, , show own logo on admin login works, have custom css. won't bother parts working i'll leave index.php, menu.xml, routes.xml, exampleadminnewpage_helloworld_index , files in templates out of because works fine.
app/code file structure
app/code/vendor └── exampleadminnewpage ├── composer.json ├── controller │ └── adminhtml │ └── helloworld │ └── index.php ├── etc │ ├── adminhtml │ │ ├── menu.xml │ │ └── routes.xml │ ├── di.xml │ └── module.xml ├── registration.php └── view └── adminhtml ├── layout │ └── exampleadminnewpage_helloworld_index.xml └── templates ├── helloworld.phtml ├── intro.css └── js.phtml
app/code/vendor/exampleadminnewpage/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:objectmanager/etc/config.xsd"> <type name="magento\theme\model\view\design"> <arguments> <argument name="themes" xsi:type="array"> <item name="adminhtml" xsi:type="string">vendor/test_admin</item> </argument> </arguments> </type> </config>
app/code/vendor/exampleadminnewpage/registration.php
<?php \magento\framework\component\componentregistrar::register( \magento\framework\component\componentregistrar::module, 'vendor_exampleadminnewpage', __dir__ );
app/code/vendor/exampleadminnewpage/etc/module.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:module/etc/module.xsd"> <module name="vendor_exampleadminnewpage" setup_version="1.0.0"> <sequence> <module name="magento_backend"/> </sequence> </module> </config>
app/design file structure
app/design/adminhtml/vendor └── test_admin ├── magento_sales │ └── templates │ ├── items │ │ └── column │ │ └── name.phtml │ └── pageactions.phtml ├── registration.php ├── theme.xml └── web ├── css │ └── styles.css ├── images │ └── magento-logo.svg > own logo , shows @ admin login! └── js └── requirejs-config.js
the following echo doesn't work, had expected if went sales>orders, i'd see echo? app/design/adminhtml/vendor/test_admin/magento_sales/templates/items/column/name.phtml
<?php echo 'test'; ?>
same goes echo, expected see echo @ sales>orders
app/design/adminhtml/vendor/test_admin/magento_sales/templates/pageactions.phtml
<?php echo 'testpageaction'; ?>
the css works, supposed through way? , can find original back-end css/less?
app/design/adminhtml/vendor/test_admin/web/css/styles.css
span { background-color: red !important; }
i don't know how js working, have. app/design/adminhtml/vendor/test_admin/web/js/requirejs-config.js
var config = { map: { '*': { customadmin: 'vendor_test_admin/js/customadmin' } }, deps: ["jquery"] };
app/design/adminhtml/vendor/test_admin/registration.php
<?php /** * copyright © 2016 magento. rights reserved. * see copying.txt license details. */ \magento\framework\component\componentregistrar::register( \magento\framework\component\componentregistrar::theme, 'adminhtml/vendor/test_admin', // example: 'adminhtml/magento/backend' __dir__ );
public_html/app/design/adminhtml/vendor/test_admin/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="urn:magento:framework:config/etc/theme.xsd"> <title>test_admin theme</title> <!-- theme's name --> <parent>magento/backend</parent> <!-- parent theme. example: magento/backend --> </theme>
i hope question clear, it's bit unclear me , that's why maybe can't word correctly hope have enough.
Comments
Post a Comment