Skip to content

Move StoreView column renderer to Store module #10226

Description

@ldusan84

When creating a custom grid using UI components, the "Store" column can be created like this:

<column name="store_id" class="Magento\Store\Ui\Component\Listing\Column\Store">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="bodyTmpl" xsi:type="string">ui/grid/cells/html</item>
                    <item name="sortable" xsi:type="boolean">false</item>
                    <item name="label" xsi:type="string" translate="true">Store View</item>
                </item>
            </argument>
        </column>

Where the class attribute value is the column renderer.

The Magento\Store\Ui\Component\Listing\Column\Store column renderer works correctly for the cases where the entity can belong to multiple store views such cms block, cms page, etc.

If you want your entity to belong to only one store view you need to use Magento\Search\Ui\Component\Listing\Column\StoreView as Magento\Store\Ui\Component\Listing\Column\Store doesn't work correctly in that case (shows blank for all store views).

I think that Magento\Search\Ui\Component\Listing\Column\StoreView belongs to the Store module instead of Search module.

There shouldn't be a need to have an additional dependency to Search module just to get the store view column renderer.

The naming can also be improved, maybe Magento\Store\Ui\Component\Listing\Column\MultipleStoreView and Magento\Store\Ui\Component\Listing\Column\SingleStoreView

Hope it makes sense.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions