0

I want to override the login page (com_users/login). I want to add new class to the 2 fields (username and password) and also if possible to change the structure from

<label></label>
<input>

to

<label><input><label>

But in the templates/template/html/com_users/login/default_login.php they are called like this :

echo $ this-> form-> renderFieldset ('credentials');

I found that the fields are loaded from this file /components/com_users/models/forms/login.xml

I tried to copy that file to templates/template/code/com_users/models/forms/login.xml but still doesn't work.

Anybody can help me?

0

To change field attributes you have to modify the form. This is normally done using a plugin with onContentPrepareForm event. But if the changes are only cosmetic I guess this could be done in the layout too.

To add another class to username field:

$this->form->setFieldAttribute('username', 'class', $this->form->getFieldAttribute('username', 'class') . ' myClass');

To change how fields are rendered make overrides of layouts/joomla/form/renderfield.php and layouts/joomla/form/renderlabel.php. Layout overrides can be global or component-specific. If you want to make the changes only to com_users place the overrides in templates/your_template/layouts/com_users/joomla/form. Note, this will affect all forms in com_users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.