Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 应用/设计和应用/代码使用的正确方式Magento 2 Adminhtml_Php_Module_Magento2 - Fatal编程技术网

Php 应用/设计和应用/代码使用的正确方式Magento 2 Adminhtml

Php 应用/设计和应用/代码使用的正确方式Magento 2 Adminhtml,php,module,magento2,Php,Module,Magento2,我想了解两件事: 扩展Magento 2 Admin CSS(或执行更少操作的正确方法?)以从原始后端复制CSS/less 在后端重写,例如:销售>订单>被调用的文件vendor/magento/module backend/view/adminhtml/templates/pageactions.phtml 我跟着 & 检查不同的stackoverflow柱,如 但我现在无法正确理解这一点 例如,我希望覆盖magento登录的CSS。我何时使用应用程序/代码,何时使用应用程序/设计,原因是

我想了解两件事:

  • 扩展Magento 2 Admin CSS(或执行更少操作的正确方法?)以从原始后端复制CSS/less
  • 在后端重写,例如:销售>订单>被调用的文件vendor/magento/module backend/view/adminhtml/templates/pageactions.phtml
  • 我跟着 &

    检查不同的stackoverflow柱,如

    但我现在无法正确理解这一点

    例如,我希望覆盖magento登录的CSS。我何时使用应用程序/代码,何时使用应用程序/设计,原因是什么?在这个例子中,我尝试了这两种方法,但我不确定在哪里放置什么,原因是什么。有些帖子提到通过应用程序/代码进行覆盖,但我的应用程序/设计css更改也有效,这是正确的吗?

    我成功地为后端创建了一个自定义页面,通过这个模块,我还通过di.xml激活了自定义adminhtml模板,并在管理员登录上显示了我自己的徽标,这样就可以工作了,我还拥有自定义CSS。我不会为正在工作的部分打扰您,所以我将把Index.php、menu.xml、routes.xml、exampleadminnewpage\u helloworld\u索引和模板中的文件排除在外,因为这样可以正常工作

    应用程序/代码文件结构

            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/design/adminhtml/Vendor/Test\u Admin/Magento\u sales/templates/items/column/name.phtml

        <?php echo 'test'; ?>
    
    我也不知道如何让JS工作,目前我有。 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\u Admin/registration.php

        <?php
        \Magento\Framework\Component\ComponentRegistrar::register(
            \Magento\Framework\Component\ComponentRegistrar::MODULE,
            'Vendor_ExampleAdminNewPage',
            __DIR__
        );
    
    <?php
    /**
     * Copyright © 2016 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::THEME,
        'adminhtml/Vendor/Test_admin', // Example: 'adminhtml/Magento/backend'
        __DIR__
    );
    
    
    
        <?php echo 'testpageaction'; ?>
    
        span {
            background-color: red !important;
        }
    
    var config = {
        map: {
            '*': {
                customAdmin: 'Vendor_Test_Admin/js/customAdmin'
            }
        },
        deps: ["jquery"]
    };
    
    <?php
    /**
     * Copyright © 2016 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::THEME,
        'adminhtml/Vendor/Test_admin', // Example: 'adminhtml/Magento/backend'
        __DIR__
    );
    
    <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
        <title>Test_Admin Theme</title> <!-- your theme's name -->
        <parent>Magento/backend</parent> <!-- the parent theme. Example: Magento/backend -->
    </theme>