I'm attempting develop a module in drupal-8 that provides a link to an external password reset system. Specifically on the login page I'd like a reset my password link that points to a link such as https://reset.my.password/

I've tried adding my module.links.task.yml file. What else do I have to create to add an external link?

  • 1
    links.task.yml files are for defining local tasks. It is not clear if that is the kind of link you are looking to achieve? Where do you want the link to be displayed? To whom? – stevekeiretsu Feb 12 at 1:16

You can try hook_menu_local_tasks_alter

 * Implements hook_menu_local_tasks_alter().
function mymodule_menu_local_tasks_alter(&$data, $route_name, RefinableCacheableDependencyInterface &$cacheability) {
  foreach ($data['tabs'] as &$tab){
    $tab['routing_name']['#link']['url'] = Url::fromUri('https://reset.my.password/');
| improve this answer | |
  • See the comment on the question. – kiamlaluno Feb 12 at 6:25

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.