1616class BlockFactory
1717{
1818 /**
19- * Object manager
20- *
2119 * @var ObjectManagerInterface
2220 */
2321 protected $ objectManager ;
@@ -38,10 +36,9 @@ class BlockFactory
3836 public function __construct (
3937 ObjectManagerInterface $ objectManager ,
4038 \Magento \Framework \ObjectManager \ConfigInterface $ config
41- )
42- {
39+ ) {
4340 $ this ->objectManager = $ objectManager ;
44- $ this ->config = $ config ;
41+ $ this ->config = $ config ;
4542 }
4643
4744 /**
@@ -54,10 +51,14 @@ public function __construct(
5451 */
5552 public function createBlock ($ blockName , array $ arguments = [])
5653 {
57- $ blockName = ltrim ($ blockName , '\\' );
58- $ configArguments = $ this ->config ->getArguments ($ blockName );
59- if (isset ($ configArguments ['data ' ])) {
60- $ arguments ['data ' ]+= $ configArguments ['data ' ];
54+ $ blockName = ltrim ($ blockName , '\\' );
55+ $ configArguments = $ this ->config ->getArguments ($ blockName );
56+ if ($ configArguments != null && isset ($ configArguments ['data ' ])) {
57+ if ($ arguments != null && isset ($ arguments ['data ' ])) {
58+ $ arguments ['data ' ] = array_merge ($ arguments ['data ' ], $ configArguments ['data ' ]);
59+ } else {
60+ $ arguments ['data ' ] = $ configArguments ['data ' ];
61+ }
6162 }
6263 $ block = $ this ->objectManager ->create ($ blockName , $ arguments );
6364 if (!$ block instanceof BlockInterface) {
0 commit comments