File tree Expand file tree Collapse file tree 3 files changed +48
-2
lines changed
templates/catalog/product/attribute Expand file tree Collapse file tree 3 files changed +48
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright 2025 Adobe
4
+ * All Rights Reserved.
5
+ */
6
+ declare (strict_types=1 );
7
+
8
+ namespace Magento \Catalog \ViewModel \Attribute ;
9
+
10
+ use Magento \Framework \View \Element \Block \ArgumentInterface ;
11
+ use Magento \Catalog \Helper \Data as CatalogHelper ;
12
+
13
+ class ProductAttributeHelper implements ArgumentInterface
14
+ {
15
+ /**
16
+ * @var CatalogHelper
17
+ */
18
+ private CatalogHelper $ catalogHelper ;
19
+
20
+ /**
21
+ * @param CatalogHelper $catalogHelper
22
+ */
23
+ public function __construct (CatalogHelper $ catalogHelper )
24
+ {
25
+ $ this ->catalogHelper = $ catalogHelper ;
26
+ }
27
+
28
+ /**
29
+ * Retrieve the Catalog Helper instance
30
+ *
31
+ * @return CatalogHelper
32
+ */
33
+ public function getCatalogHelper (): CatalogHelper
34
+ {
35
+ return $ this ->catalogHelper ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" ?>
2
2
<!--
3
3
/**
4
- * Copyright 2013 Adobe
4
+ * Copyright 2014 Adobe
5
5
* All Rights Reserved.
6
6
*/
7
7
-->
22
22
<block class =" Magento\Catalog\Block\Adminhtml\Product\Attribute\Edit" name =" attribute_edit_content" />
23
23
</referenceContainer >
24
24
<referenceContainer name =" js" >
25
- <block class =" Magento\Backend\Block\Template" name =" attribute_edit_js" template =" Magento_Catalog::catalog/product/attribute/js.phtml" />
25
+ <block class =" Magento\Backend\Block\Template" name =" attribute_edit_js" template =" Magento_Catalog::catalog/product/attribute/js.phtml" >
26
+ <arguments >
27
+ <argument name =" view_model" xsi : type =" object" >Magento\Catalog\ViewModel\Attribute\ProductAttributeHelper</argument >
28
+ </arguments >
29
+ </block >
26
30
</referenceContainer >
27
31
</body >
28
32
</page >
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ use Magento\Catalog\Helper\Data;
13
13
<?php
14
14
/** @var \Magento\Framework\Json\Helper\Data $jsonHelper */
15
15
$ jsonHelper = $ block ->getData ('jsonHelper ' );
16
+ if (!method_exists ($ jsonHelper , 'getAttributeHiddenFields ' )) {
17
+ /** @var \Magento\Catalog\ViewModel\Attribute\ProductAttributeHelper $viewModel */
18
+ $ viewModel = $ block ->getViewModel ();
19
+ $ jsonHelper = $ viewModel ->getCatalogHelper ();
20
+ }
16
21
$ scriptString = <<<script
17
22
require([
18
23
"jquery",
You can’t perform that action at this time.
0 commit comments