I'm creating a module using blocks and view models, but when is it better to use view models instead of blocks?


1 Answer 1


You just need a Block if you want to set a template filename dynamically or change something in Block functions like _prepareLayout, apart from that, if your template file is fixed, and you want to get data from some collection or model, you can use ViewModel.

These are two great references about it:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.