QuestionQ17

Adobe Experience Manager Sites

An Adobe Commerce developer uses a view model within an existing block:

Question Image

Which two methods can access the view model class from the template?

Choose two
  • A $block->getData('view_model')
  • B $block->viewModel()
  • C $block->getViewModel()
  • D $block->getData('viewModel')
Explanation

A layout argument named view_model can be retrieved directly with getData('view_model') or through its CamelCase magic getter, getViewModel(). Adobe Commerce documents both forms for a view_model block argument.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!