diff --git a/Helper/Data.php b/Helper/Data.php index 0270dde..f404bb0 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -36,7 +36,11 @@ public function isEnabled() */ public function isCustomerEditAdminPage() { - return $this->_request->getFullActionName() === 'customer_index_edit'; + return $this->_request->getFullActionName() === 'customer_index_edit' || + ( + $this->_request->getFullActionName() === 'mui_index_render_handle' && + $this->_request->getParam('handle') === 'customer_address_edit' + ); // Address form uses MUI renderer since ~2.4 } /** diff --git a/Plugin/Component/AbstractComponentPlugin.php b/Plugin/Component/AbstractComponentPlugin.php index 86585f5..6e6c2de 100644 --- a/Plugin/Component/AbstractComponentPlugin.php +++ b/Plugin/Component/AbstractComponentPlugin.php @@ -37,9 +37,17 @@ public function __construct( public function afterGetChildComponents(AbstractComponent $subject, $result) { if ($this->_dataHelper->isCustomerEditAdminPage() && $this->_dataHelper->isEnabled()) { + + $dataProvider = $subject->getContext()->getDataProvider()->getName(); + if ($subject->getName() == 'customer') { $this->hideFields($result, $this->_dataHelper->getCustomerAttributeArray()); - } elseif ($subject->getName() == 'address') { + } elseif ( + // Address form fields are in a separate UI component XML from ~2.4 + // Using data source to identify correct component to match + ($dataProvider == 'customer_address_form_data_source' && $subject->getName() == 'general') || + ($dataProvider == 'customer_form_data_source' && $subject->getName() == 'address') + ) { $this->hideFields($result, $this->_dataHelper->getCustomerAddressAttributeArray()); } } diff --git a/composer.json b/composer.json index 894e963..24650ac 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "magepal/magento2-core": ">=1.1.10" }, "type": "magento2-module", - "version": "1.1.0", + "version": "1.1.1", "autoload": { "files": [ "registration.php"