0

I am accessing block function in phtml like

$blockObj= $block->getLayout()->createBlock('Esparksinc\Extension\Block\Product\View');

but this gave Waring of class notation instead while cheqing code during coding standarded.

0

Change

$blockObj= $block->getLayout()->createBlock('Esparksinc\Extension\Block\Product\View');

instead of

$blockObj= $block->getLayout()->createBlock(\Esparksinc\Extension\Block\Product\View:class);

Or, Add this block using layout.

0

Bacically block is attached with its phtml so we can directly call block function from phtml so there is no need to create the block object at all like.

$block->callBlockFunction();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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