Domanda

I have a custom module and created etc/adminhtml/menu.xml

I want to open my menu item in new browser tab.

Is there any option available in magento to achieve this/set target="_blank" ?

Any help would be appreciated !!!

È stato utile?

Soluzione

Yes, there is a way. I didn't know it is that easy. I just tried it myself and it is working.

Just use target="_blank" in xml like this:

<add id="Vendor_Module::id"
             title="Menu title"
             module="Vendor_Module"
             sortOrder="60"
             parent="Vendor_Module::parent"
             action="your_action"
             resource="Vendor_Module::resource"
             target="_blank" />

Altri suggerimenti

Try this code in any of your JS files which are being called in the backend:

require(['jquery'],
    $(document).ready(function() {
        $("#nav li a").attr("target", "_blank");
    });
);

It would be better to name the tab instead of using _blank, so multiple clicks on your menu item don't open multiple tabs.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top