My question is very simple but I couldn't find any answers so far.

Is it possible to properly override or extend a Magento 2 module ? (Without duplicating the module sources).

Here is an example:

Let's say I want to add a new attribute to the Review object from the module Magento_Review. I know how to extend EAV objects like Product, Customer, ... but is it possible to extend the Review object.

So far I've created a module with a setup adding a column to the Review table. But the problem now is that I dont know if I can properly override ui components to display it in my admin views without editing the module source files.

Thanks for your answers.


You can totally do this.

In your case there's no need to extend nor override anything, Magento will do the merge for you.

All you need to do is to create view/adminhtml/ui_component/review_listing.xml in your module folder with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <columns name="review_columns">
        <column name="your_column">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="filter" xsi:type="string">textRange</item>
                    <item name="sorting" xsi:type="string">asc</item>
                    <item name="label" xsi:type="string" translate="true">Your Column</item>
                    <item name="sortOrder" xsi:type="number">0</item>

Don't forget to replace the values with the one you need ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.