We want to follow the best practice to add additional functionality to a block template without "rewriting" (i.e. a DI preference) the block.
Is there a nice way to inject the main block (which methods we need to access) to a view model ?
We were thinking about the following code inside of the template:
<?php $block->getViewModel()->setBlock($block); ?>
But is that the right way to do it?