Download the PHP package liquidlab-agency/magento2-multiline-grid without Composer
On this page you can find all versions of the php package liquidlab-agency/magento2-multiline-grid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liquidlab-agency/magento2-multiline-grid
More information about liquidlab-agency/magento2-multiline-grid
Files in liquidlab-agency/magento2-multiline-grid
Package magento2-multiline-grid
Short Description Magento 2 module that preserves line breaks in text area custom attributes when displayed in the admin product grid.
License MPL-2.0
Informations about the package magento2-multiline-grid
LiquidLab MultilineGrid Module
This module provides a solution for displaying multiline text in Magento 2 admin grids. It preserves line breaks in text area custom attributes when displayed in the admin product grid.
Before and After
Before
After
Installation
To install the module via Composer:
After installation:
- The module is already installed in your Magento 2 instance.
- After making any changes to the module, you need to deploy the static content and clear the cache:
Usage
The module automatically applies to all columns in the admin grid. No additional configuration is needed in your UI component XML.
How It Works
The module uses a mixin approach to:
- Extend the default Magento UI column functionality
- Convert newlines (
\n) to HTML<br>tags - Use Knockout's
htmlbinding instead oftextbinding to preserve HTML formatting
This ensures that line breaks in text area fields are properly displayed in the admin grid without requiring any changes to your UI component XML files.
Technical Details
The module follows Magento's best practices for mixins:
- The
requirejs-config.jsfile is placed in theview/adminhtmldirectory - It defines a mixin for the
Magento_Ui/js/grid/columns/columncomponent - The mixin overrides the
getLabelmethod to convert newlines to<br>tags 4The mixin sets thebodyTmplto use a custom template with thehtmlbinding using the mapped path:bodyTmpl: 'Liquidlab_MultilineGrid/grid/cells/multiline'
This approach automatically applies to all columns in the admin grid, making it a more elegant solution than creating a custom column type.
After making changes to the module, always run the deployment commands listed in the Installation section to ensure the changes take effect. This is especially important when modifying RequireJS configurations and template paths.