File tree 7 files changed +353
-85
lines changed
Test/Unit/Block/System/Config
dev/tests/integration/testsuite/Magento/Config/Block/System/Config
7 files changed +353
-85
lines changed Original file line number Diff line number Diff line change @@ -425,24 +425,10 @@ private function getFieldData(\Magento\Config\Model\Config\Structure\Element\Fie
425
425
if ($ placeholderValue ) {
426
426
$ data = $ placeholderValue ;
427
427
}
428
+
428
429
if ($ data === null ) {
429
- if (array_key_exists ($ path , $ this ->_configData )) {
430
- $ data = $ this ->_configData [$ path ];
431
-
432
- if ($ field ->hasBackendModel ()) {
433
- $ backendModel = $ field ->getBackendModel ();
434
- $ backendModel ->setPath ($ path )
435
- ->setValue ($ data )
436
- ->setWebsite ($ this ->getWebsiteCode ())
437
- ->setStore ($ this ->getStoreCode ())
438
- ->afterLoad ();
439
- $ data = $ backendModel ->getValue ();
440
- }
441
- } elseif ($ field ->getConfigPath () !== null ) {
442
- $ data = $ this ->getConfigValue ($ field ->getConfigPath ());
443
- } else {
444
- $ data = $ this ->getConfigValue ($ path );
445
- }
430
+ $ path = $ field ->getConfigPath () !== null ? $ field ->getConfigPath () : $ path ;
431
+ $ data = $ this ->getConfigValue ($ path );
446
432
}
447
433
448
434
return $ data ;
Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \Config \Model \Config \Backend ;
7
7
8
+ use Magento \Framework \App \Config \Data \ProcessorInterface ;
8
9
use Magento \Framework \App \ObjectManager ;
9
10
use Magento \Framework \Serialize \Serializer \Json ;
10
11
11
12
/**
12
13
* @api
13
14
* @since 100.0.2
14
15
*/
15
- class Serialized extends \Magento \Framework \App \Config \Value
16
+ class Serialized extends \Magento \Framework \App \Config \Value implements ProcessorInterface
16
17
{
17
18
/**
18
19
* @var Json
@@ -67,4 +68,12 @@ public function beforeSave()
67
68
parent ::beforeSave ();
68
69
return $ this ;
69
70
}
71
+
72
+ /**
73
+ * @inheritdoc
74
+ */
75
+ public function processValue ($ value )
76
+ {
77
+ return empty ($ value ) ? '' : $ this ->serializer ->unserialize ($ value );
78
+ }
70
79
}
Original file line number Diff line number Diff line change @@ -543,12 +543,12 @@ public function initFieldsDataProvider()
543
543
return [
544
544
[
545
545
['section1/group1/field1 ' => 'some_value ' ],
546
- false ,
547
- null ,
546
+ ' some_value ' ,
547
+ ' section1/group1/field1 ' ,
548
548
false ,
549
549
'some_value ' ,
550
550
null ,
551
- 1 ,
551
+ 0 ,
552
552
false ,
553
553
false ,
554
554
false
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Config \Block \System \Config ;
8
+
9
+ use Magento \Config \Block \System \Config \Form \Field \FieldArray \AbstractFieldArray ;
10
+
11
+ /**
12
+ * Backend system config array field renderer for integration test.
13
+ */
14
+ class FieldArray extends AbstractFieldArray
15
+ {
16
+ /**
17
+ * @inheritdoc
18
+ */
19
+ protected function _toHtml ()
20
+ {
21
+ $ value = '' ;
22
+ $ element = $ this ->getElement ();
23
+ if ($ element ->getValue () && is_array ($ element ->getValue ())) {
24
+ $ value = implode ('| ' , $ element ->getValue ());
25
+ }
26
+
27
+ return sprintf (
28
+ '<input id="%s" name="%s" value="%s" /> ' ,
29
+ $ element ->getId (),
30
+ $ element ->getName (),
31
+ $ value
32
+ );
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments