I want to override mone method prepare of class
Magento\Ui\Component\Form\Element\AbstractOptionsField
I tried to do with preference but there is no effect
I also tried using plugin but it throws error
below is my plugin code
<type name="Magento\Ui\Component\Form\Element\AbstractOptionsField">
<plugin name="aroundPrepare_override" type="Vendor\Custom\Plugin\AbstractOptionsField"/>
</type>
AbstractOptionsField file
<?php
namespace Vendor\Custom\Plugin;
use Magento\Framework\Data\OptionSourceInterface;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
class AbstractOptionsField extends \Magento\Ui\Component\Form\Element\AbstractElement
{
public function __construct(
ContextInterface $context,
$options = null,
array $components = [],
array $data = []
) {
$this->options = $options;
parent::__construct($context, $components, $data);
}
public function aroundPrepare(
\Magento\Ui\Component\Form\Element\AbstractOptionsField $subject,
\Closure $proceed
) {
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/customer123.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info("test");
}
}
Can anyone help me what I missing.
error
Class Vendor\Custom\Plugin\AbstractOptionsField contains 1 abstract method and must therefore be declared abstract or implement the remaining methods