I need to get the file PATH for an image in pub/static/[VENDOR_THEME]
folder.
Currently, I can do this by using a helper:
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\View\Asset\Repository $assetRepository,
\Magento\Framework\App\Filesystem\DirectoryList $directoryList
) {
parent::__construct($context);
$this->_assetRepo = $assetRepository;
$this->_directoryList = $directoryList;
}
public function getImagePath($image)
{
return $this->_directoryList->getPath(DirectoryList::STATIC_VIEW) .
'/' .
$this->_assetRepo->getStaticViewFileContext()->getPath() .
'/' .
$image;
}
Is there any built-in Magento function which handles this, so I do not have to create my own helper?