AD0-E716 · Question #33
An Adobe Commerce developer successfully added a new column to the customers grid. This column needs the data to be formatted before showing its content in the grid. According to best practices, how…
The correct answer is A. 1. Create an after pluginforMagento\Ui\Component\Listing\Columns\Column::prepareColumn(). Option A is correct because an after plugin on Column::prepareColumn() is the proper extensibility mechanism in Adobe Commerce - it lets you modify the column's prepared data/configuration without altering core classes, which aligns with the "never modify core" principle and…
Question
An Adobe Commerce developer successfully added a new column to the customers grid. This column needs the data to be formatted before showing its content in the grid. According to best practices, how would the developer add the custom logic to render the column?
Options
- A
- Create an after pluginforMagento\Ui\Component\Listing\Columns\Column::prepareColumn().
- B
- Create a custom class extending flagento\Ui\Component\Listing\Columns\Colunm.
- C
- Override the Magento\Customer\Ui\Component\DataProvider Class using a preference.
How the community answered
(37 responses)- A78% (29)
- B8% (3)
- C14% (5)
Explanation
Option A is correct because an after plugin on Column::prepareColumn() is the proper extensibility mechanism in Adobe Commerce - it lets you modify the column's prepared data/configuration without altering core classes, which aligns with the "never modify core" principle and keeps upgrades safe.
Option B is wrong because extending Column directly and using a preference or di.xml virtual type to swap it in would replace the default column class globally or require you to redeclare every column that needs it - it's tightly coupled and fragile compared to a targeted plugin.
Option C is wrong because overriding the DataProvider via a preference affects how data is fetched, not how it is rendered/formatted in the grid column - it targets the wrong layer of the architecture and is also the most invasive approach (preferences are a last resort in Magento's extensibility hierarchy).
Memory tip: Think of the flow as fetch → prepare → render. Formatting display output belongs at the prepare step (prepareColumn), and plugins are always preferred over preferences when you only need to tweak one behavior.
Topics
Community Discussion
No community discussion yet for this question.