Reference - Grid arguments

A Loki_AdminComponents is a grid that is defined within the XML layout:

<block name="yireo-training.example-admin.grid" template="Loki_AdminComponents::grid.phtml">
    <arguments>
        <argument name="foo" xsi:type="string">bar</argument>
    </arguments>
</block>

XML layout base arguments

A grid block can be supplied with the following XML arguments:

provider (string or object, required)

A class or classname supported by available provider handlers, like collections, repositories or array providers.

provider_handler (string)

A string pointing to the provider handler. Often this is not needed, because the provider handler is detected automatically. But it can be used if the automatic detection fails or if you have added your own custom provider handler.

<block name="yireo-training.example-admin.grid" template="Loki_AdminComponents::grid.phtml">
    <arguments>
        <argument name="provider_handler" xsi:type="string">repository</argument>
    </arguments>
</block>

namespace (string)

A namespace that could correspond with the UI Bookmark name of a core grid. If you don't need UI Bookmark behaviour, you could skip this.

resource_model (string or object)

By default, a repository handler is unable to retrieve column-information from the repository. By providing the classname for the resource_model, you can help the repository handler determine things automatically. This, or you need to supply the columns in a different way.

columns (array)

By default, the grid tries to display all available columns, but this might include columns that you don't want to display. By adding the columns property, you can add your own columns to the grid instead.

<block name="yireo-training.example-admin.grid">
    <arguments>
        <argument name="columns" xsi:type="array">
            <item name="id" xsi:type="string">ID</item>
            <item name="name" xsi:type="string">Name</item>
            <item name="description" xsi:type="string">Description</item>
        </argument>
    </arguments>
</block>

cell_templates (array)

A listing of PHTML templates where the name of the item resembles the name of the column.

<block name="yireo-training.example-admin.grid">
    <arguments>
        <argument name="cell_templates" xsi:type="array">
            <item name="foobar" xsi:type="string">YireoTraining_ExampleAdmin::grid/cell/foobar.phtml</item>
        </argument>
    </arguments>
</block>

edit_url (string)

If the URL to edit an item is not */*/form, then it needs to be changed with this argument.

<block name="yireo-training.example-admin.grid" template="Loki_AdminComponents::grid.phtml">
    <arguments>
        <argument name="edit_url" xsi:type="string">*/*/edit</argument>
    </arguments>
</block>

searchable_fields (array)

A simple array of fields that are allowed to search through. By default, this is all fields.

Last modified: September 1, 2025