Change form title for a custom entity I'm just trying to clone a d7 site in 8.  My first step was to use drupal console to generate a custom entity.  Everything is working fine but I want to change the title of the form to "Create project" instead of the default "Add project".

I don't see "Add " anywhere except for module.links.action.yml, but that is just the local action - it doesn't change the name of the form.

The root of the directory looks like:

config
  schema
    project_entity_type.schema.yml
src
  Entity
    ...several classes
  Form
    ...several classes
  templates
    ...couple template files
  Tests
    LoadTest.php
module.page.inc
module.links.action.yml
module.links.menu.yml
module.links.tasks.yml
module.module
module.permissions.yml
The answer comes from here: https://www.drupal.org/node/2187643.

Note: change "module" in the below code to the name of your module.

The first step is to register an event subscriber service. In module.services.yml:

services:
  module.route_subscriber:
    class: Drupal\module\Routing\RouteSubscriber
    tags:
      - { name: event_subscriber }


Next, create your class RouteSubscriber and extend RouteSubscriberBase:

  namespace Drupal\module\Routing;

  use Drupal\Core\Routing\RouteSubscriberBase;
  use Symfony\Component\Routing\RouteCollection;

  /**
   * Subscribe to the Route to change page titles.
   */
  class RouteSubscriber extends RouteSubscriberBase {

    private function alterRoutes(RouteCollection $collection) {
      if ($route = $collection-&gt;get('entity.project_entity.add_form')) {
        // set the title (or override '_title_callback' below)
        $route-&gt;setDefault('_title', 'Create Project Request');
        // unset the _title_callback; alternatively you could override it here
        $route-&gt;setDefault('_title_callback', '');
      }
    }
  }


Note that you receive a RouteCollection in alterRoutes and then using the $collection-get() will return an instance of Route.  The documentation for Route can be found here: http://api.symfony.com/2.7/Symfony/Component/Routing/Route.html

If you're having trouble figuring out what your routes are, the excellent drupal console drupal route:debug tool will help you.