File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
lib/internal/Magento/Framework/View/Model/Layout Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1818 * Layout merge model
1919 * @SuppressWarnings(PHPMD.TooManyFields)
2020 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
21+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2122 */
2223class Merge implements \Magento \Framework \View \Layout \ProcessorInterface
2324{
@@ -462,6 +463,8 @@ public function load($handles = [])
462463 return $ this ;
463464 }
464465
466+ $ this ->extractHandlers ();
467+
465468 foreach ($ this ->getHandles () as $ handle ) {
466469 $ this ->_merge ($ handle );
467470 }
@@ -951,4 +954,25 @@ public function getCacheId()
951954 // phpcs:ignore Magento2.Security.InsecureFunction
952955 return $ this ->generateCacheId (md5 (implode ('| ' , array_merge ($ this ->getHandles (), $ layoutCacheKeys ))));
953956 }
957+
958+ /**
959+ * Walk all updates and extract handles before the merge step.
960+ */
961+ private function extractHandlers (): void
962+ {
963+ foreach ($ this ->updates as $ update ) {
964+ $ updateXml = null ;
965+
966+ try {
967+ $ updateXml = $ this ->_loadXmlString ($ update );
968+ // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
969+ } catch (\Exception $ exception ) {
970+ // ignore invalid
971+ }
972+
973+ if ($ updateXml && strtolower ($ updateXml ->getName ()) == 'update ' && isset ($ updateXml ['handle ' ])) {
974+ $ this ->addHandle ((string )$ updateXml ['handle ' ]);
975+ }
976+ }
977+ }
954978}
You can’t perform that action at this time.
0 commit comments