Skip to content

Commit 8ad8b26

Browse files
authored
Merge pull request #7246 from magento-gl/revert-28-AC-1077
Revert "AC-1077::Unable to pass data argument by di.xml for block ins…
2 parents 1ef4504 + 02c49ef commit 8ad8b26

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

lib/internal/Magento/Framework/View/Element/BlockFactory.php

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
namespace Magento\Framework\View\Element;
77

88
use Magento\Framework\ObjectManagerInterface;
9-
use Magento\Framework\ObjectManager\ConfigInterface;
10-
use Magento\Framework\App\ObjectManager;
119

1210
/**
1311
* Creates Blocks
@@ -22,25 +20,14 @@ class BlockFactory
2220
*/
2321
protected $objectManager;
2422

25-
/**
26-
* Object manager config
27-
*
28-
* @var ConfigInterface
29-
*/
30-
private $config;
31-
3223
/**
3324
* Constructor
3425
*
3526
* @param ObjectManagerInterface $objectManager
36-
* @param ConfigInterface $config
3727
*/
38-
public function __construct(
39-
ObjectManagerInterface $objectManager,
40-
?ConfigInterface $config = null
41-
) {
28+
public function __construct(ObjectManagerInterface $objectManager)
29+
{
4230
$this->objectManager = $objectManager;
43-
$this->config = $config ?: ObjectManager::getInstance()->get(ConfigInterface::class);
4431
}
4532

4633
/**
@@ -53,9 +40,8 @@ public function __construct(
5340
*/
5441
public function createBlock($blockName, array $arguments = [])
5542
{
56-
$blockName = ltrim($blockName, '\\');
57-
$arguments = $this->getConfigArguments($blockName, $arguments);
58-
$block = $this->objectManager->create($blockName, $arguments);
43+
$blockName = ltrim($blockName, '\\');
44+
$block = $this->objectManager->create($blockName, $arguments);
5945
if (!$block instanceof BlockInterface) {
6046
throw new \LogicException($blockName . ' does not implement BlockInterface');
6147
}
@@ -64,24 +50,4 @@ public function createBlock($blockName, array $arguments = [])
6450
}
6551
return $block;
6652
}
67-
68-
/**
69-
* Get All Config Arguments based on Block Name
70-
*
71-
* @param string $blockName
72-
* @param array $arguments
73-
* @return array $arguments
74-
*/
75-
private function getConfigArguments($blockName, array $arguments = [])
76-
{
77-
if (!$this->config) {
78-
return $arguments;
79-
}
80-
$configArguments = $this->config->getArguments($blockName);
81-
if ($configArguments && isset($configArguments['data'])) {
82-
$arguments['data'] = ($arguments && isset($arguments['data'])) ?
83-
array_merge($arguments['data'], $configArguments['data']) : $configArguments['data'];
84-
}
85-
return $arguments;
86-
}
8753
}

0 commit comments

Comments
 (0)