File tree Expand file tree Collapse file tree 4 files changed +24
-9
lines changed
lib/internal/Magento/Framework/View Expand file tree Collapse file tree 4 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -207,13 +207,15 @@ protected function scheduleReference(
207207 $ elementRemove = filter_var ($ currentElement ->getAttribute ('remove ' ), FILTER_VALIDATE_BOOLEAN );
208208 if ($ elementRemove ) {
209209 $ scheduledStructure ->setElementToRemoveList ($ elementName );
210- } else {
211- $ data = $ scheduledStructure ->getStructureElementData ($ elementName , []);
212- $ data ['attributes ' ] = $ this ->mergeBlockAttributes ($ data , $ currentElement );
213- $ this ->updateScheduledData ($ currentElement , $ data );
214- $ this ->evaluateArguments ($ currentElement , $ data );
215- $ scheduledStructure ->setStructureElementData ($ elementName , $ data );
210+ return ;
211+ } elseif ($ currentElement ->getAttribute ('remove ' )) {
212+ $ scheduledStructure ->unsetElementFromListToRemove ($ elementName );
216213 }
214+ $ data = $ scheduledStructure ->getStructureElementData ($ elementName , []);
215+ $ data ['attributes ' ] = $ this ->mergeBlockAttributes ($ data , $ currentElement );
216+ $ this ->updateScheduledData ($ currentElement , $ data );
217+ $ this ->evaluateArguments ($ currentElement , $ data );
218+ $ scheduledStructure ->setStructureElementData ($ elementName , $ data );
217219 }
218220
219221 /**
Original file line number Diff line number Diff line change @@ -141,11 +141,12 @@ protected function containerReference(
141141 ) {
142142 $ containerName = $ currentElement ->getAttribute ('name ' );
143143 $ containerRemove = filter_var ($ currentElement ->getAttribute ('remove ' ), FILTER_VALIDATE_BOOLEAN );
144-
145144 if ($ containerRemove ) {
146145 $ scheduledStructure ->setElementToRemoveList ($ containerName );
147- } else {
148- $ this ->mergeContainerAttributes ($ scheduledStructure , $ currentElement );
146+ return ;
147+ } elseif ($ currentElement ->getAttribute ('remove ' )) {
148+ $ scheduledStructure ->unsetElementFromListToRemove ($ containerName );
149149 }
150+ $ this ->mergeContainerAttributes ($ scheduledStructure , $ currentElement );
150151 }
151152}
Original file line number Diff line number Diff line change @@ -188,6 +188,12 @@ public function testProcessReference(
188188 $ setCondition ,
189189 $ setRemoveCondition
190190 ) {
191+ if ($ literal == 'referenceBlock ' && $ remove == 'false ' ) {
192+ $ this ->scheduledStructure ->expects ($ this ->once ())
193+ ->method ('unsetElementFromListToRemove ' )
194+ ->with ($ literal );
195+ }
196+
191197 $ this ->context ->expects ($ this ->once ())->method ('getScheduledStructure ' )
192198 ->will ($ this ->returnValue ($ this ->scheduledStructure ));
193199
Original file line number Diff line number Diff line change @@ -102,6 +102,12 @@ public function testProcess(
102102 ->with ($ contextMock , $ elementCurrent )
103103 ->willReturnSelf ();
104104
105+ if ($ elementCurrent ->getAttribute ('remove ' ) == 'false ' ) {
106+ $ scheduledStructureMock ->expects ($ this ->once ())
107+ ->method ('unsetElementFromListToRemove ' )
108+ ->with ($ elementCurrent ->getAttribute ('name ' ));
109+ }
110+
105111 $ this ->container ->interpret ($ contextMock , $ elementCurrent );
106112 }
107113
You can’t perform that action at this time.
0 commit comments