0

I have a controller and I have created block using createBlock method in controller and have passed a userid to it

$block = $this->_pageFactory->create();

$block->getLayout() ->createBlock('Magecomp\Crud\Block\GetUserById','magecompcrud.edituser',['data'=>['userid'=>$userid]]);

Now how can I access this userid in blcok or blcok method

1 Answer 1

0

you can use setData after createBlock

example

$block->getLayout()->createBlock()->setData('key',value)

To retrieve data from block

$block->getData('key');

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.