@@ -42,6 +42,7 @@ protected function compileBlock(string $type, string $id, string $propertiesExpr
4242
4343 $ hash = hash ('xxh128 ' , $ id );
4444 $ idVar = '$__blockId ' .$ hash ;
45+ $ parentIdVar = '$__blockParentId ' .$ hash ;
4546 $ blockDataVar = '$__blockData ' .$ hash ;
4647
4748 $ compiler = app (BlockCompilerRegistry::class)->findCompiler ($ schema );
@@ -60,16 +61,17 @@ protected function compileBlock(string $type, string $id, string $propertiesExpr
6061 <?php
6162 if (isset( \$block)) {
6263 {$ idVar } = craftile()->resolveStaticBlockId( \$block->id, ' {$ id }') ?? craftile()->generateChildId( \$block->id, ' {$ id }');
64+ {$ parentIdVar } = \$block->id;
6365 } else {
6466 {$ idVar } = ' {$ id }';
67+ {$ parentIdVar } = null;
6568 }
6669
67- {$ blockDataVar } = BlockDatastore::getBlock( {$ idVar }, ['static' => true, 'repeated' => {$ repeatedExpr }]);
70+ {$ blockDataVar } = BlockDatastore::getBlock( {$ idVar }, ['parentId' => { $ parentIdVar } , 'semanticId' => ' { $ id } ', ' static' => true, 'repeated' => {$ repeatedExpr }]);
6871
6972 if (! {$ blockDataVar }) {
70- {$ blockDataVar } = craftile()->createBlockData(['id' => {$ idVar }, 'type' => ' {$ type }', 'static' => true, 'repeated' => {$ repeatedExpr }]);
73+ {$ blockDataVar } = craftile()->createBlockData(['id' => {$ idVar }, 'type' => ' {$ type }', 'parentId' => { $ parentIdVar } , 'semanticId' => ' { $ id } ', ' static' => true, 'repeated' => {$ repeatedExpr }]);
7174 }
72-
7375 ?>
7476 <?php if (craftile()->inPreview()) {
7577 craftile()->startBlock( {$ idVar }, $ blockDataVar);
0 commit comments