Hey guys,
I'm fighting with something that should be really easy, but this doesn't seem to be the case.
I want to override com_contact/model/forms/contact.xml in my template.
Why I want to override the file - well I want to add a class to the input fields that the component generates... (just a class - not new fields or whatever)
Is there any way to override this file? I don't seem to be able to figure out what I need to do.
Thank you in advance!
Daniel
Tags:
Permalink Reply by Michael Bech on September 27, 2011 at 12:37am Try having a look here : http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
Think this is what you are looking for. You can also take a look in the default templates. Here you will find af html folder. This is how you are able to display content in a customized way.
/ Michael
Permalink Reply by Daniel Dimitrov on September 27, 2011 at 2:28am Hey Michael,
Thank you for the link, but this is not what I'm looking for.
In j1.6 and 1.7 we are presented with the jform class. Trough a configuration file that resides in models/forms - we define what fields our forms will have, what classes they have, what kind of input is allowed etc... I'm searching for a way to override this file and from what I've found so far - you can't override this file with a template override.
Cheers,
Daniel
Permalink Reply by Michael Bech on September 27, 2011 at 3:01am Ohh i see and no you are right as far as i know. But what you need to do then is to extend the JFormField class
Here's what you do :
1. Go to your models folder (administrator/components/com_COMPONENTNAME/models/).
2. Create a new folder and call it fields. In this folder you can create your custom fields for JForm.
3. The name you give this file is the name that you put in the form (.xml file)
Take a look at the administrator part of com_modules or com_banners to see examples (administrator/components/com_modules/models/fields/)
Hope that helps
Michael
Permalink Reply by Samir H. on November 19, 2011 at 12:05pm Hi,
i dont know if there is a better solution, but you could write a plugin and use one of the appropriate events (onContentPrepareForm, onContentPrepareData, dont know if they work good with com_contact though) to hook in, then you can just define your own xml and in that xml define the fields exactly like in the xml you want to override (including <fieldsets> etc).
Thats how i did that overriding some registration fields.
© 2012 Created by Amy Stephen.