Skip to main content
added 1315 characters in body
Source Link
HelgeB
  • 4.5k
  • 2
  • 11
  • 27

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'report1'){
        //place your plugin code here...
    }
}

In addition to have module specific controllers (for gridToCsv and gridToXml) you should create for each module a controller extending the original controller of the Ui module. Example for GridToCsv for module Report1 (place this content into GridToCsv.php in Controller/Adminhtml/Export directory):

namespace Vendor\Report1\Controller\Adminhtml\Export;

class GridToCsv extends Magento\Ui\Controller\Adminhtml\Export\GridToCsv\Magento\Ui\Controller\Adminhtml\Export\GridToCsv
{   
        
}

Create a routes.xml file in etc/adminthtml of your module (if it not exists already). Example for module Report1:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route frontName="report1" id="report1">
            <module name="Vendor_Report1" before="Magento_Backend" />
        </route>
    </router>
</config>

The definition of the ui component should be updated for each module like in this answer How to override definition.xml file in Magento 2? Especially the urlparameter should be like this according to the code above (Example for module Report1 and action gridToCsv):

<item name="url" xsi:type="string">report1/export/gridToCsv</item>

If you make thisthese changes for all the affected modules, the approach should work.

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'report1'){
        //place your plugin code here...
    }
}

In addition to have module specific controllers (for gridToCsv and gridToXml) you should create for each module a controller extending the original controller of the Ui module. Example for GridToCsv for module Report1:

namespace Vendor\Report1\Controller\Adminhtml\Export;

class GridToCsv extends Magento\Ui\Controller\Adminhtml\Export\GridToCsv
{   
        
}

Create a routes.xml file in etc/adminthtml of your module (if it not exists already). Example for module Report1:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route frontName="report1" id="report1">
            <module name="Vendor_Report1" before="Magento_Backend" />
        </route>
    </router>
</config>

The definition of the ui component should be updated for each module like in this answer How to override definition.xml file in Magento 2? Especially the urlparameter should be like this according to the code above (Example for module Report1 and action gridToCsv):

<item name="url" xsi:type="string">report1/export/gridToCsv</item>

If you make this changes for all the affected modules, the approach should work.

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'report1'){
        //place your plugin code here...
    }
}

In addition to have module specific controllers (for gridToCsv and gridToXml) you should create for each module a controller extending the original controller of the Ui module. Example for GridToCsv for module Report1 (place this content into GridToCsv.php in Controller/Adminhtml/Export directory):

namespace Vendor\Report1\Controller\Adminhtml\Export;

class GridToCsv extends \Magento\Ui\Controller\Adminhtml\Export\GridToCsv
{   
        
}

Create a routes.xml file in etc/adminthtml of your module (if it not exists already). Example for module Report1:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route frontName="report1" id="report1">
            <module name="Vendor_Report1" before="Magento_Backend" />
        </route>
    </router>
</config>

The definition of the ui component should be updated for each module like in this answer How to override definition.xml file in Magento 2? Especially the urlparameter should be like this according to the code above (Example for module Report1 and action gridToCsv):

<item name="url" xsi:type="string">report1/export/gridToCsv</item>

If you make these changes for all the affected modules, the approach should work.

added 1315 characters in body
Source Link
HelgeB
  • 4.5k
  • 2
  • 11
  • 27

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'Report1''report1'){
        //place your plugin code here...
    }
}

In addition to have module specific controllers (for gridToCsv and gridToXml) you should create for each module a controller extending the original controller of the Ui module. Example for GridToCsv for module Report1:

namespace Vendor\Report1\Controller\Adminhtml\Export;

class GridToCsv extends Magento\Ui\Controller\Adminhtml\Export\GridToCsv
{   
        
}

Create a routes.xml file in etc/adminthtml of your module (if it not exists already). Example for module Report1:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route frontName="report1" id="report1">
            <module name="Vendor_Report1" before="Magento_Backend" />
        </route>
    </router>
</config>

The definition of the ui component should be updated for each module like in this answer How to override definition.xml file in Magento 2? Especially the urlparameter should be like this according to the code above (Example for module Report1 and action gridToCsv):

<item name="url" xsi:type="string">report1/export/gridToCsv</item>

If you make this changes for all the affected modules, the approach should work.

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'Report1'){
        //place your plugin code here...
    }
}

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'report1'){
        //place your plugin code here...
    }
}

In addition to have module specific controllers (for gridToCsv and gridToXml) you should create for each module a controller extending the original controller of the Ui module. Example for GridToCsv for module Report1:

namespace Vendor\Report1\Controller\Adminhtml\Export;

class GridToCsv extends Magento\Ui\Controller\Adminhtml\Export\GridToCsv
{   
        
}

Create a routes.xml file in etc/adminthtml of your module (if it not exists already). Example for module Report1:

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route frontName="report1" id="report1">
            <module name="Vendor_Report1" before="Magento_Backend" />
        </route>
    </router>
</config>

The definition of the ui component should be updated for each module like in this answer How to override definition.xml file in Magento 2? Especially the urlparameter should be like this according to the code above (Example for module Report1 and action gridToCsv):

<item name="url" xsi:type="string">report1/export/gridToCsv</item>

If you make this changes for all the affected modules, the approach should work.

Source Link
HelgeB
  • 4.5k
  • 2
  • 11
  • 27

I'm not sure if I understood your problem, but you may check the modulename of the request in your plugin methods and execute the code only if the request module name matches.

For example adding some code like this in your plugins may help you solving the problem (example for module Report1):

namespace Vendor\Report1\Plugin;
    
class ModifyExportPlugin
{
    protected $request;
    
    public function __construct(
       \Magento\Framework\App\RequestInterface $request
        
    ) {
       $this->request = $request;
    }
    
    //check the current request module name in your plugin functions
    if (request->getModuleName() == 'Report1'){
        //place your plugin code here...
    }
}