Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By trk_ on
Hi
Please, where the HTML is located?
<div class="form-item form-type-password form-item-pass">
<label class="element-invisible" for="edit-pass--3">Password <span class="form-required" title="This field is required.">*</span></label>
<input placeholder="Password" id="edit-pass--3" name="pass" size="15" maxlength="128" class="form-text required" type="password">
</div>
I need to insert a link a href
after the password field:
<input placeholder="Password" id="edit-pass--3" name="pass" size="15" maxlength="128" class="form-text required" type="password"><a href="password-reset">Password reset</a>
and I do not understand where it is located.
I look at user.module file but can not see it there.
Thank you
Comments
=-=
may aid to understand what you are trying to do as hacking user.module may not be the way you want to interact.
I would like to insert a link
I would like to insert a link. Nothing more.
I think this is possible to hard code in?
But I can not find the place (file) where it should be done.
Thank you :)
=-=
hacking core/contrib files is always possible. the question should be is it warranted. In your situation (most situations) hacking core/contrib files isn't warranted as one can utilize hooks and preprocessing function interact with core. Hacking core files creates a tedious update/upgrade process for no reason.
Sure, I know this situation.
Sure, I know this situation.
But I work this way many years.
You need to implement hook
You need to implement hook_form_alter() and add your link as a #markup element to that.
I know the above does not make sense to you, so you'll need to spend some time learning how Drupal hooks work and module development works: https://www.drupal.org/documentation/develop
Jaypan, thank you but it is
Jaypan, thank you but it is not what I need.
I have this code:
I have this code:
If I place a link in
If I place a link in
then it is placed in wrong place, out off the div
It should be inside the div:
form should be altered
You need to use hook_form_BASE_FORM_ID_alter() function. Put the below function in template.php
Thank you but your code does
Thank you but your code does not work the way I need.
I need to add a link after the password input (inside div wrapper) and your code adds a link outside of it:
<input></div><a>link</a>
Should be:
<input><a>link</a></div>
function bartik_form_user
This does not work
This adds a link outside of the password input div wrapper.
Should be inside.
This code does not change my login box it should be.
It changes only admins login at user/login - I do not need it.
Thank you for help
If you need it to be inside,
If you need it to be inside, you'll need to instead override theme_password() in your theme.
Too difficult to understand
Too difficult to understand for me.
Very simple question - where is the place I could directly put my link in. (without any hook codings - I do not need this additional problem)
Thank you
Thank you very much
Thank you very much
I do understand now - it is form.inc file.
This is exactly what I need
If that worked for you, that
If that worked for you, that's great.
For anyone else who may stumble across this thread however, this is one of the biggest no-no's in Drupal - shouldn't hack core files. Your changes will be overwritten on the next core update, or you'll have to remember to go in and make the change again.
What alternative?
What alternative?
If the hook https://www.drupal.org/node/2799623#comment-11621425 can not place the link exactly in the neccessary place.
Or there is another hook to achieve the task?
Jaypen, this is not
Jaypen, this is not appropriate solution to add a link in function theme_password($variables)
If I do this then my link is added to all password fields.
But I need it only for the password field located in the login block.
May be there is another place in the core where the block password input exist?
Thank you