Override user edit page title By default, the user form title is the user's username which looks a little ugly if you're using the email registration module. In Drupal 7 I used to solve this problem using the title override module which is not ported do Drupal 8. 

I would like to change the user form title to "Login details". Is this possible using a hook? If so: how do I do this?
The title override module utilizes drupal_set_title() to do this in Drupal 7. This function is deprecated in Drupal 8. The D8 equivalent here is to alter the _title_callback for the entity.user.edit_form route.

This is done by using an event subscriber to alter the RoutingEvents::ALTER event. This can be done through a custom module that:


Registering a new service class in mymodule.services.yml that is tagged with event_subscriber (see d.o. documentation example).
Defining the new service class to extend RouteSubscriberBase (see d.o. documentation example).
Implementing the alterRoutes(RouteCollection $collection) method within the service class to alter the entity.user.edit_form route (see example below).
A class/method that defines the title callback (see UserController::userTitle() as an example).


Within your route subscriber class:

  /**
   * {@inheritdoc}
   */
  public function alterRoutes(RouteCollection $collection) {
    // Retrieve the user edit form route.
    if ($route = $collection-&gt;get('entity.user.edit_form')) {
      // Your module will need a controller class/method defined in
      // src/Controller/CustomUserController::userTitle
      // see core/modules/user/src/Controller/UserController.php to see how this
      // is implemented by default
      $route-&gt;setDefault('_title_callback','Drupal\mymodule\Controller\CustomUserController::userTitle');
    }
  }