Tutorial: Widget Menu Customisation
Customising Menus for Specific Widget Types
The examples given below apply the changes to all widget types. In cases where the changes should only apply to
widgets of a specific type, use the hyva_dashboard_widget_instance_{{WIDGET_TYPE_ID}} handle instead.
Removing Menu Items
- Create the
hyva_dashboard_widget_instance.xmllayout file - Reference the specific menu item block and set the
removeattribute totrue
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="widget-instance.menu.foo" remove="true"/>
</body>
</page>
Adding Menu Items
- Create the
hyva_dashboard_widget_instance.xmllayout file - Add a new block to the
widget-instance.menublock
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="widget-instance.menu">
<block name="foo" template="Vendor_Module::path/to/foo.phtml"/>
</referenceBlock>
</body>
</page>
Reordering Menu Items
- Create the
hyva_dashboard_widget_instance.xmllayout file - Reference the specific menu item block(s) and use the
beforeand/orafterattributes to reposition them