7
7
8
8
namespace Magento \PageBuilder \Component \Form \Element ;
9
9
10
+ use Magento \Catalog \Setup \CategorySetup ;
10
11
use Magento \Framework \App \ObjectManager ;
11
12
use Magento \Framework \Data \FormFactory ;
12
13
use Magento \Framework \View \Asset \Repository ;
17
18
use Magento \PageBuilder \Model \Config as PageBuilderConfig ;
18
19
use Magento \PageBuilder \Model \State as PageBuilderState ;
19
20
use Magento \PageBuilder \Model \Stage \Config as Config ;
20
- use Magento \Framework \View \ConfigInterface as ViewConfigInterface ;
21
21
22
22
/**
23
23
* Updates wysiwyg element with Page Builder specific config
@@ -45,11 +45,10 @@ class Wysiwyg extends \Magento\Ui\Component\Form\Element\Wysiwyg
45
45
* @param array $config
46
46
* @param PageBuilderConfig|null $pageBuilderConfig
47
47
* @param bool $overrideSnapshot
48
- * @param Repository $assetRepo
48
+ * @param Repository|null $assetRepo
49
49
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
50
50
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
51
51
* @SuppressWarnings(PHPMD.NPathComplexity)
52
- * @throws \Magento\Framework\Exception\NoSuchEntityException
53
52
*/
54
53
public function __construct (
55
54
ContextInterface $ context ,
@@ -66,14 +65,14 @@ public function __construct(
66
65
Repository $ assetRepo = null
67
66
) {
68
67
$ this ->assetRepo = $ assetRepo ?: ObjectManager::getInstance ()->get (Repository::class);
69
- $ wysiwygConfigData = isset ( $ config ['wysiwygConfigData ' ]) ? $ config [ ' wysiwygConfigData ' ] : [];
68
+ $ wysiwygConfigData = $ config ['wysiwygConfigData ' ] ?? [];
70
69
71
70
// If a dataType is present we're dealing with an attribute
72
71
if (isset ($ config ['dataType ' ])) {
73
72
try {
74
73
$ attribute = $ attrRepository ->get ($ data ['name ' ]);
75
74
76
- if ($ attribute ) {
75
+ if ($ attribute && $ attribute -> getEntityTypeId () === CategorySetup:: CATEGORY_ENTITY_TYPE_ID ) {
77
76
$ config ['wysiwyg ' ] = (bool )$ attribute ->getIsWysiwygEnabled ();
78
77
}
79
78
} catch (NoSuchEntityException $ e ) {
0 commit comments