2
votes

I'm working on the default login page in Joomla 3.
I overrided

/templates/MYTEMPLATE/html/com_users/login/default_login.php  

and it's working fine but in that file to generate the form field it uses JForm, which create the html tags using :

/components/com_users/models/forms/login.xml  

Now what I would like to do is override that file to add an additional class to the input field. I tried several combinations:

/templates/MYTEMPLATE/html/com_users/login.xml
/templates/MYTEMPLATE/html/com_users/login/login.xml  
/templates/MYTEMPLATE/html/com_users/models/forms/login.xml
/templates/MYTEMPLATE/html/com_users/models/login.xml

No one of them is working.

1

1 Answers

1
votes

As suggested in here

You can copy login.xml and default.php in

/templates/MYTEMPLATE/html/com_users/login/forms/login.xml 
/templates/MYTEMPLATE/html/com_users/login/default.php 

After you have to edit default.php and add the following lines

$this->form->reset( true );   
$this->form->loadFile( dirname(__FILE__) . DS . "forms" . DS . "login.xml");

Once you do that you can edit login.xml

In my case I just added form-control to the attribute class

<field name="username" type="text"
        class="validate-username form-control"
        filter="username"
        label="COM_USERS_LOGIN_USERNAME_LABEL"
        size="25"
        required="true"
        validate="username"
    />