13
13
*/
14
14
namespace Magento \Framework \Data \Form \Element ;
15
15
16
+ use Magento \Framework \Escaper ;
17
+
16
18
class Editablemultiselect extends \Magento \Framework \Data \Form \Element \Multiselect
17
19
{
20
+ /**
21
+ * @var \Magento\Framework\Serialize\Serializer\Json
22
+ */
23
+ private $ serializer ;
24
+
25
+ /**
26
+ * Editablemultiselect constructor.
27
+ * @param Factory $factoryElement
28
+ * @param CollectionFactory $factoryCollection
29
+ * @param Escaper $escaper
30
+ * @param array $data
31
+ * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
32
+ */
33
+ public function __construct (
34
+ Factory $ factoryElement ,
35
+ CollectionFactory $ factoryCollection ,
36
+ Escaper $ escaper ,
37
+ array $ data = [],
38
+ \Magento \Framework \Serialize \Serializer \Json $ serializer = null
39
+ ) {
40
+ parent ::__construct ($ factoryElement , $ factoryCollection , $ escaper , $ data );
41
+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
42
+ ->get (\Magento \Framework \Serialize \Serializer \Json::class);
43
+ }
44
+
18
45
/**
19
46
* Name of the default JavaScript class that is used to make multiselect editable
20
47
*
@@ -41,7 +68,7 @@ public function getElementHtml()
41
68
$ elementJsClass = $ this ->getData ('element_js_class ' );
42
69
}
43
70
44
- $ selectConfigJson = \Zend_Json:: encode ($ selectConfig );
71
+ $ selectConfigJson = $ this -> serializer -> serialize ($ selectConfig );
45
72
$ jsObjectName = $ this ->getJsObjectName ();
46
73
47
74
// TODO: TaxRateEditableMultiselect should be moved to a static .js module.
0 commit comments