Skip to main content

I am getting the following error on di compile:

Extra parameters passed to parent construct $directoryHelper

**Extra parameters passed to parent construct $directoryHelper** 

ThatsThat's the original code:

class PreviewButton extends \Magento\Config\Block\System\Config\Form\Field {

class PreviewButton extends \Magento\Config\Block\System\Config\Form\Field { protected $blockFactory;    public function __construct(   \Magento\Backend\Block\Template\Context $context,   \Magento\Framework\View\Element\BlockFactory $blockFactory,   array $data = [],   ?SecureHtmlRenderer $jsonHelper = null,   ?DirectoryHelper $directoryHelper = null  ) {   $this->blockFactory = $blockFactory;   parent::__construct($context, $data, $jsonHelper, $directoryHelper);  } 

i extended it and my construct is :

class PreviewButton extends OriginalPreviewButton { protected $_directoryHelper;

class PreviewButton extends OriginalPreviewButton { protected $_directoryHelper; public function __construct(   \Magento\Backend\Block\Template\Context $context,   \Magento\Framework\View\Element\BlockFactory $blockFactory,   array $data = [],   ?SecureHtmlRenderer $jsonHelper = null,   ?DirectoryHelper $directoryHelper = null  ) {   OriginalPreviewButton::__construct($context, $blockFactory, $data, $jsonHelper);   $this->blockFactory = $blockFactory;  } 

but i am still getting the same error. Can someone help to fix the error? Thanks in advance

I am getting the following error on di compile:

Extra parameters passed to parent construct $directoryHelper

Thats the original code:

class PreviewButton extends \Magento\Config\Block\System\Config\Form\Field {

protected $blockFactory; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\View\Element\BlockFactory $blockFactory, array $data = [], ?SecureHtmlRenderer $jsonHelper = null, ?DirectoryHelper $directoryHelper = null ) { $this->blockFactory = $blockFactory; parent::__construct($context, $data, $jsonHelper, $directoryHelper); } 

i extended it and my construct is :

class PreviewButton extends OriginalPreviewButton { protected $_directoryHelper;

public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\View\Element\BlockFactory $blockFactory, array $data = [], ?SecureHtmlRenderer $jsonHelper = null, ?DirectoryHelper $directoryHelper = null ) { OriginalPreviewButton::__construct($context, $blockFactory, $data, $jsonHelper); $this->blockFactory = $blockFactory; } 

but i am still getting the same error. Can someone help to fix the error? Thanks in advance

I am getting the following error on di compile:

**Extra parameters passed to parent construct $directoryHelper** 

That's the original code:

class PreviewButton extends \Magento\Config\Block\System\Config\Form\Field { protected $blockFactory;    public function __construct(   \Magento\Backend\Block\Template\Context $context,   \Magento\Framework\View\Element\BlockFactory $blockFactory,   array $data = [],   ?SecureHtmlRenderer $jsonHelper = null,   ?DirectoryHelper $directoryHelper = null  ) {   $this->blockFactory = $blockFactory;   parent::__construct($context, $data, $jsonHelper, $directoryHelper);  } 

i extended it and my construct is :

class PreviewButton extends OriginalPreviewButton { protected $_directoryHelper; public function __construct(   \Magento\Backend\Block\Template\Context $context,   \Magento\Framework\View\Element\BlockFactory $blockFactory,   array $data = [],   ?SecureHtmlRenderer $jsonHelper = null,   ?DirectoryHelper $directoryHelper = null  ) {   OriginalPreviewButton::__construct($context, $blockFactory, $data, $jsonHelper);   $this->blockFactory = $blockFactory;  } 

but i am still getting the same error. Can someone help to fix the error? Thanks in advance

Source Link

Extra parameters passed to parent construct $directoryHelper

I am getting the following error on di compile:

Extra parameters passed to parent construct $directoryHelper

Thats the original code:

class PreviewButton extends \Magento\Config\Block\System\Config\Form\Field {

protected $blockFactory; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\View\Element\BlockFactory $blockFactory, array $data = [], ?SecureHtmlRenderer $jsonHelper = null, ?DirectoryHelper $directoryHelper = null ) { $this->blockFactory = $blockFactory; parent::__construct($context, $data, $jsonHelper, $directoryHelper); } 

i extended it and my construct is :

class PreviewButton extends OriginalPreviewButton { protected $_directoryHelper;

public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\View\Element\BlockFactory $blockFactory, array $data = [], ?SecureHtmlRenderer $jsonHelper = null, ?DirectoryHelper $directoryHelper = null ) { OriginalPreviewButton::__construct($context, $blockFactory, $data, $jsonHelper); $this->blockFactory = $blockFactory; } 

but i am still getting the same error. Can someone help to fix the error? Thanks in advance