If I need to insert image inside admin form inside function _prepareForm I simply call this:
$this->getViewFileUrl("Company_Module::images/icon.png")
But this doesn't work if I call it within custom field renderer
<?php
namespace Company\Module\Block\Adminhtml\Renderer;
class Customtype extends \Magento\Framework\Data\Form\Element\AbstractElement{
var_dump($this->getViewFileUrl("Company_Module::images/icon.png")); //returns null
}
What would be a proper way to get image url in this case?