Magento 2-如何使用插件

问题描述

我正在使用Magento2。我想在扩展块中设置颜色和其他较小的变量,例如:@primary__color。

有人知道该怎么做吗?我尝试使用aroundplugin,但未调用文件

<?PHP

namespace Module\MyModule\Plugin\Css;

use Magento\Framework\Css\PreProcessor\Adapter\Less\Processor as Lessprocessor;
use Magento\Framework\View\Asset\File;

/**
 * Class Processor
 */
class Processor
{
    public function aroundProcessContent(
    Lessprocessor $subject,callable $proceed,File $asset)
    {   
    echo 'Hi'; exit;
    return $proceed($asset);
    }
}

我本打算在文件添加以下代码,但不知道如何实现

$array = [];
$array['primary__color'] ='#000000';
.....
$parser->parseFile($tmpFilePath,''); //just after this line of code write below line of code
$parser->ModifyVars($array); // this code is modifying variables

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)