File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -150,6 +150,11 @@ public function getBlock(): ?AbstractBlock
150150 return $ this ->block ;
151151 }
152152
153+ public function setBlock (AbstractBlock $ block ): void
154+ {
155+ $ this ->block = $ block ;
156+ }
157+
153158 public function getGlobalMessageRegistry (): GlobalMessageRegistry
154159 {
155160 return $ this ->globalMessageRegistry ;
Original file line number Diff line number Diff line change @@ -45,7 +45,10 @@ public function getComponentFromBlock(AbstractBlock $block): Component
4545 throw new NoComponentFoundException ((string )__ ('Block has no name ' , $ block ->getJsId ()));
4646 }
4747
48- return $ this ->getComponentByName ($ blockName );
48+ $ component = $ this ->getComponentByName ($ blockName );
49+ $ component ->setBlock ($ block );
50+
51+ return $ component ;
4952 }
5053
5154 /**
Original file line number Diff line number Diff line change @@ -102,12 +102,14 @@ public function execute(): ResultInterface|ResponseInterface
102102 *
103103 * @return ComponentUpdate[]
104104 */
105- private function getComponentUpdates (array $ updates ): array
105+ private function getComponentUpdates (array $ updates, LayoutInterface $ layout ): array
106106 {
107107 $ componentUpdates = [];
108108 foreach ($ updates as $ updateIndex => $ update ) {
109+ $ block = $ this ->getBlock ($ layout , $ update ['blockName ' ]);
109110 $ componentUpdate = $ this ->componentUpdateFactory ->create ([
110- 'component ' => $ this ->componentRegistry ->getComponentByName ($ update ['blockName ' ]),
111+ 'block ' => $ block ,
112+ 'component ' => $ this ->componentRegistry ->getComponentFromBlock ($ block ),
111113 'componentData ' => $ update ['update ' ],
112114 ]);
113115
Original file line number Diff line number Diff line change 33namespace Loki \Components \Util \Controller ;
44
55use Loki \Components \Component \Component ;
6-
6+ use Magento \ Framework \ View \ Element \ AbstractBlock ;
77class ComponentUpdate
88{
99 public function __construct (
10+ private readonly AbstractBlock $ block ,
1011 private readonly Component $ component ,
1112 private readonly mixed $ componentData = null
1213 ) {
1314 }
1415
16+ public function getBlock (): AbstractBlock
17+ {
18+ return $ this ->block ;
19+ }
20+
1521 public function getComponent (): Component
1622 {
1723 return $ this ->component ;
You can’t perform that action at this time.
0 commit comments