diff --git a/vendor/magento/module-catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php b/vendor/magento/module-catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php index a0ca53dce4f5..1caeae73b078 100644 --- a/vendor/magento/module-catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php +++ b/vendor/magento/module-catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php @@ -18,6 +18,7 @@ use Magento\Catalog\Model\Entity\Attribute; use Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker; use Magento\Framework\Data\FormFactory; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Registry; /** @@ -58,9 +59,11 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc + * * @return $this * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @throws LocalizedException */ protected function _prepareForm() { @@ -179,28 +182,34 @@ protected function _prepareForm() ['form' => $form, 'attribute' => $attributeObject] ); + $dependencies = $this->getLayout()->createBlock( + \Magento\Backend\Block\Widget\Form\Element\Dependence::class + )->addFieldMap( + "is_html_allowed_on_front", + 'html_allowed_on_front' + )->addFieldMap( + "frontend_input", + 'frontend_input_type' + )->addFieldMap( + "is_searchable", + 'searchable' + )->addFieldMap( + "is_visible_in_advanced_search", + 'advanced_search' + )->addFieldDependence( + 'advanced_search', + 'searchable', + '1' + ); + $this->_eventManager->dispatch( + 'adminhtml_catalog_product_attribute_edit_frontend_prepare_field_dependencies', + ['dependencies' => $dependencies] + ); + // define field dependencies $this->setChild( 'form_after', - $this->getLayout()->createBlock( - \Magento\Backend\Block\Widget\Form\Element\Dependence::class - )->addFieldMap( - "is_html_allowed_on_front", - 'html_allowed_on_front' - )->addFieldMap( - "frontend_input", - 'frontend_input_type' - )->addFieldMap( - "is_searchable", - 'searchable' - )->addFieldMap( - "is_visible_in_advanced_search", - 'advanced_search' - )->addFieldDependence( - 'advanced_search', - 'searchable', - '1' - ) + $dependencies ); $this->setForm($form); diff --git a/vendor/magento/module-catalog-search/etc/search_request.xml b/vendor/magento/module-catalog-search/etc/search_request.xml index 376e4ced4d5a..e26eb6f58191 100644 --- a/vendor/magento/module-catalog-search/etc/search_request.xml +++ b/vendor/magento/module-catalog-search/etc/search_request.xml @@ -20,10 +20,9 @@ - + - diff --git a/vendor/magento/module-layered-navigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFormFieldDependenciesObserver.php b/vendor/magento/module-layered-navigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFormFieldDependenciesObserver.php new file mode 100644 index 000000000000..5e22e3c40904 --- /dev/null +++ b/vendor/magento/module-layered-navigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFormFieldDependenciesObserver.php @@ -0,0 +1,50 @@ +moduleManager = $moduleManager; + } + + /** + * Adds field related dependencies in the administrator attribute edit form + * + * @param Observer $observer + * @return void + */ + public function execute(Observer $observer) + { + if (!$this->moduleManager->isOutputEnabled('Magento_LayeredNavigation')) { + return; + } + /** @var BlockInterface $dependencies */ + $dependencies = $observer->getDependencies(); + $dependencies->addFieldMap('is_filterable_in_search', 'filterable_in_search'); + $dependencies->addFieldDependence( + 'filterable_in_search', + 'searchable', + '1' + ); + } +} diff --git a/vendor/magento/module-layered-navigation/Plugin/Save/AdjustAttributeSearchable.php b/vendor/magento/module-layered-navigation/Plugin/Save/AdjustAttributeSearchable.php new file mode 100644 index 000000000000..c002e9231cdf --- /dev/null +++ b/vendor/magento/module-layered-navigation/Plugin/Save/AdjustAttributeSearchable.php @@ -0,0 +1,33 @@ + + + + + + + + diff --git a/vendor/magento/module-layered-navigation/etc/adminhtml/events.xml b/vendor/magento/module-layered-navigation/etc/adminhtml/events.xml index abe083bdf682..98cb957f723f 100644 --- a/vendor/magento/module-layered-navigation/etc/adminhtml/events.xml +++ b/vendor/magento/module-layered-navigation/etc/adminhtml/events.xml @@ -12,4 +12,7 @@ + + +