Skip to content

Tutorial: Widget Category Management

Making changes to widget categories involves updating the type configuration for the Hyva\AdminDashboardFramework\Model\Config\Widget\Converter class via etc/di.xml.

Adding New Categories

Add a new <item> to the type's categoryNames argument.

<type name="Hyva\AdminDashboardFramework\Model\Config\Widget\Converter">
    <arguments>
        <argument name="categoryNames" xsi:type="array">
            <!-- The item name is the value used in the hyva_dashboard_widget.xml configuration -->
            <item name="foo" xsi:type="array">
                <item name="enabled" xsi:type="boolean">true</item>
                <item name="label" xsi:type="string">Foo</item>
                <item name="sortOrder" xsi:type="number">500</item>
            </item>
        </argument>
    </arguments>
</type>

Removing Categories

Set the enabled flag to false for the category to remove.

<type name="Hyva\AdminDashboardFramework\Model\Config\Widget\Converter">
    <arguments>
        <argument name="categoryNames" xsi:type="array">
            <item name="sales" xsi:type="array">
                <item name="enabled" xsi:type="boolean">false</item>
            </item>
        </argument>
    </arguments>
</type>

Reordering Categories

Update the sortOrder value of the category you want to move to a number before, after, or between other sortOrder values.

<type name="Hyva\AdminDashboardFramework\Model\Config\Widget\Converter">
    <arguments>
        <argument name="categoryNames" xsi:type="array">
            <item name="catalog" xsi:type="array">
                <item name="sortOrder" xsi:type="number">1</item>
            </item>
        </argument>
    </arguments>
</type>

Updating Category Names

Update the label value of the category you want to rename.

<type name="Hyva\AdminDashboardFramework\Model\Config\Widget\Converter">
    <arguments>
        <argument name="categoryNames" xsi:type="array">
            <item name="system" xsi:type="array">
                <item name="label" xsi:type="string">Configuration</item>
            </item>
        </argument>
    </arguments>
</type>

Info

Category names are translated in the relevant template(s) - there is no need to update category names for the purpose of translating them.

Changing the Default Category

Update the defaultCategoryName argument value to the name of the new default category.

<type name="Hyva\AdminDashboardFramework\Model\Config\Widget\Converter">
    <arguments>
        <argument name="defaultCategoryName" xsi:type="string">foo</argument>
    </arguments>
</type>

Warning

The default category MUST be enabled.