From 44ac243bef5d786bc6e669d3323764a15ad47def Mon Sep 17 00:00:00 2001 From: matteorossi-thespacesm <61690145+matteorossi-thespacesm@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:28:32 +0100 Subject: [PATCH] Update AbstractForm.php Added override of \Magento\Backend\Block\Widget\Form method getForm to resolve Error: "RemovePasswordAndUserConfirmationFormFieldsPlugin::afterGetForm(): Argument #2 ($result) must be of type Magento\Framework\Data\Form, null" in magento 2.4.5, as addressed in https://github.com/magento/magento2/issues/36145 --- Block/Adminhtml/Magento/Form/AbstractForm.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Block/Adminhtml/Magento/Form/AbstractForm.php b/Block/Adminhtml/Magento/Form/AbstractForm.php index 89d04647e..28feebbeb 100644 --- a/Block/Adminhtml/Magento/Form/AbstractForm.php +++ b/Block/Adminhtml/Magento/Form/AbstractForm.php @@ -71,7 +71,16 @@ public function __construct( parent::__construct($context, $registry, $formFactory, $data); } - + + public function getForm() + { + if ($this->_form == null) { + return $this->_formFactory->create(); + } else { + return $this->_form; + } + } + protected function _prepareLayout() { parent::_prepareLayout();