2

Here one issue in my magento 2.1. I create one di.xml file for my own module but i got error in cms page and static block. Check below image for cms page and static block error.

CMS Page:- enter image description here

Static Block:- enter image description here

And Below my di.xml code for admin panel. (Job/Test/etc/adminhtml/di.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:ObjectManager/etc/config.xsd">   
    <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool" type="Magento\Ui\DataProvider\Modifier\Pool">
        <arguments>
            <argument name="modifiers" xsi:type="array">
                <item name="testtab" xsi:type="array">
                    <item name="class" xsi:type="string">Job\Test\Ui\Component\DataProvider\Product\Modifier\Testtab</item>
                    <item name="sortOrder" xsi:type="number">200</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Job\Test\Ui\Component\DataProvider\Product\Modifier\Testtab">
        <arguments>
            <argument name="scopeName" xsi:type="string">product_form.product_form</argument>
        </arguments>
    </type>
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="testtab_test_listing_data_source" xsi:type="string">Job\Test\Model\ResourceModel\Test\Grid\Collection</item>
                <item name="demo_index_grid_data_source" xsi:type="string">Job\Test\Model\ResourceModel\Test\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
</config>
3

Grid di.xml is global. So when you create your custom module admin grid, your di.xml should be under etc folder, not etc/adminhtml. So

Move Job/Test/etc/adminhtml/di.xml to Job/Test/etc/di.xml

|improve this answer|||||
  • Sohel, now one issue create when i move Job/Test/etc/adminhtml/di.xml to Job/Test/etc/di.xml in my custom module. I create one tab in admin catalog product page. Now this tab is disappear. – Payal Patel Aug 19 '16 at 10:39
  • You move only grid related code. So you need to create two di.xml one under etc and other etc/adminhtml. So your tab related code move to etc/adminhtml/di.xml only. – Sohel Rana Aug 19 '16 at 10:47
  • Hey Sohel, my issue solve by me for above code. Now both are working perfect. And Thank for your help – Payal Patel Aug 19 '16 at 10:50
0

I try below code and my issue solved.

Job/Test/etc/adminhtml/di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">   
    <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool" type="Magento\Ui\DataProvider\Modifier\Pool">
        <arguments>
            <argument name="modifiers" xsi:type="array">
                <item name="testtab" xsi:type="array">
                    <item name="class" xsi:type="string">Job\Test\Ui\Component\DataProvider\Product\Modifier\Testtab</item>
                    <item name="sortOrder" xsi:type="number">1000</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Job\Test\Ui\Component\DataProvider\Product\Modifier\Testtab">
        <arguments>
            <argument name="scopeName" xsi:type="string">product_form.product_form</argument>
        </arguments>
    </type>
</config>

Job/Test/etc/di.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">   
    <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
        <arguments>
            <argument name="collections" xsi:type="array">
                <item name="testtab_test_listing_data_source" xsi:type="string">Job\Test\Model\ResourceModel\Test\Grid\Collection</item>
                <item name="demo_index_grid_data_source" xsi:type="string">Job\Test\Model\ResourceModel\Test\Grid\Collection</item>
            </argument>
        </arguments>
    </type>
</config>
|improve this answer|||||

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.