I want to inject Model into core block module. That it's a simple thing to do in the wrong way (Editing core block). But i want to know how to do it in the right way. Because i want to retrieve User data in the main page.
So, how can i do it, without editing core files?
Im customizing my templates and i want to show users name into the main page,
To do that i need to inyect
\Magento\Customer\Model\Session, the answer is where?
For now i have into grid.phtml the follwing code :
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $name = $objectManager->create('\Magento\Customer\Model\Session') ->getCustomer()->getName();