I have a definition which extends a other definition and want to add a content to a a block which is inside two other BlockBlock. It is possible to access the child Blocks but it is pretty ugly:
public function configureView(DefinitionBuilder $builder, $data): void
{
parent::configureView($builder, $data);
// does work
$shipmentBlock = $builder->getBlock('topLevelBlock')->getBlocks()['rightGridBlock']->getBlocks()['shipment'];
// how I would like it to work
$shipmentBlock = $builder->getBlock('shipment');
}
Also Phpstan does not really like this solution because getBlock return an instance of Block and not BlockBlock which contains the getBlocks method. So you have to work with multiple annotations to define the var or ignore the line.
I have a definition which extends a other definition and want to add a content to a a block which is inside two other BlockBlock. It is possible to access the child Blocks but it is pretty ugly:
Also Phpstan does not really like this solution because getBlock return an instance of
Blockand notBlockBlockwhich contains thegetBlocksmethod. So you have to work with multiple annotations to define the var or ignore the line.