I am getting the following error on di compile:
**Extra parameters passed to parent construct $directoryHelper**
That’s the original code:
class PreviewButton extends MagentoConfigBlockSystemConfigFormField
{
protected $blockFactory;
public function __construct(
MagentoBackendBlockTemplateContext $context,
MagentoFrameworkViewElementBlockFactory $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(
MagentoBackendBlockTemplateContext $context,
MagentoFrameworkViewElementBlockFactory $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