Is it possible to override the default field template just in my component? How would I go about doing it?
The template I specifically want to override is "joomla.form.renderlabel"
, which is stored at layouts/joomla/form/renderlabel.php
.
I know that I could create a template override, but this would override all admin fields for all components; I just want to override them in my component, or even more specifically, in one of my admin views. So I'm looking for a way to programatically modify which template is used.
From what I can tell, 'joomla.form.renderlabel'
is hard coded into the FormField
object, so to use a different label I would need to override that. But since it's so high in the inheritance chain I think I would also have to override like... so much of Joomla. Following the chain up, I especially begin to despair as I get to the FormHelper
class.
Before I give up, I want to see if any experienced Joomla people know of some easy way to do this.
Right now I have some Javascript that does what I want: extracts descriptions and prints them underneath the labels rather than have them appear on hover. But this script is hacky and runs into problems with subforms. I feel like overriding the field template would be the right way to do it... but I also feel like it could be even more hacky if it means fighting with Joomla's architecture.