Question

Im using magento 2.3.4 and when i want to add/edit new product by default the product description and short description height is set too much like this:

enter image description here

how can i reduce this?

Was it helpful?

Solution

Write a plugin on WysiwygConfigDataProcessor::process() method. The methods return wysiwyg parameters for admin product form.

  1. Create your own module
  2. Declare your plugin (app/code/Vendor/Module/etc/adminhtml/di.xml):
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav\WysiwygConfigDataProcessor">
        <plugin name="changeProductFormWysiwygSize" type="Vendor\Module\Plugin\WysiwygConfigData" />
    </type>
</config>
  1. Code of the plugin (app/code/Vendor/Module/Plugin/WysiwygConfigData.php):
<?php

declare(strict_types=1);

namespace Vendor\Module\Plugin;

use Magento\Catalog\Api\Data\ProductAttributeInterface;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav\WysiwygConfigDataProcessor;

class WysiwygConfigData
{
    /**
     * @param WysiwygConfigDataProcessor $subject
     * @param array                      $result
     * @param ProductAttributeInterface  $attribute
     *
     * @return array
     */
    public function afterProcess(
        WysiwygConfigDataProcessor $subject,
        array $result,
        ProductAttributeInterface $attribute
    ): array {
        if (in_array($attribute->getAttributeCode(), ['description', 'short_description'])) {
            $result['height'] = '150px'; // Change this value to set your size
        }

        return $result;
    }
}

  1. Run setup:upgrade command to apply the code and module.

Hope this helps
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top