I'm trying to create a block I can call in my override of 'root.phtml'.
In the root file, I added some extra classes to the body depending on the url, so I've created a module which I call on this page.
I've overridden root.phtml in my theme folder, and I've created a seperate module to call in this phtml file. This is just to get the current URL (so if you have a better suggestion, please come forward) however when I try to load the application it comes up with
Missing required argument $data of Karl\OverrideView\Block\OverrideView
The file being refered to is;
namespace Karl\OverrideView\Block;
class OverrideView
{
public $assetRepository;
protected $_storeManager;
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
array $data = [],
\Magento\Store\Model\StoreManagerInterface $storeManager
){
$this->_storeManager = $storeManager;
return parent::construct($context, $data);
}
public function getFullUrl(){
return $this->_storeManager->getStore()->getCurrentUrl(false);
}
}