I found samples where HTMLHelper was used to load some types of files like stylesheets, scripts and images:
$this->addHeadLink(HTMLHelper::_('image', 'joomla-favicon.svg', '', [], true, 1), 'icon', 'rel', ['type' => 'image/svg+xml']);
The subject code will search for joomla-favicon.svg
in the sub-folder images
for the current template. For Joomla 4.2 the long answer is /media/templates/site/my_template/images/joomla-favicon.svg
.
In the same manner:
HTMLHelper::_('script', 'my.js', ['version' => 'auto', 'relative' => true]);
can be used my.js to be loaded from js
folder.
What about using HTMLHelper::_ for other file types? Can I have a subfolder named 'files' and force HTMLHelper to use it for a function like addHeadLink
?
My particular task is to add a head link for Web app manifest, which I can do simply by addHeadLink
, but I'm curious if I could use HTMLHelper::_
here.