Skip to main content
added 2 characters in body
Source Link
Abhishek Tripathi
  • 2.9k
  • 2
  • 19
  • 37

When you create your block with $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock');$block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock');, you can pass data to it using the 3rd argument to the createBlock function. For example:

    $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock', 'block name', ['data' => ['MyData' => 'value']]);

The data will then be accessible to your block through the $data array that is passed to it's constructor.

When you create your block with $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock');, you can pass data to it using the 3rd argument to the createBlock function. For example:

    $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock', 'block name', ['data' => ['MyData' => 'value']]);

The data will then be accessible to your block through the $data array that is passed to it's constructor.

When you create your block with $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock');, you can pass data to it using the 3rd argument to the createBlock function. For example:

    $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock', 'block name', ['data' => ['MyData' => 'value']]);

The data will then be accessible to your block through the $data array that is passed to it's constructor.

Source Link
S.Shah
  • 77
  • 1
  • 16

When you create your block with $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock');, you can pass data to it using the 3rd argument to the createBlock function. For example:

    $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock', 'block name', ['data' => ['MyData' => 'value']]);

The data will then be accessible to your block through the $data array that is passed to it's constructor.