A faster process for Drupal 8 routing conversions

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
xjm's picture

For the past six months, Drupal 8 contributors have been working hard on converting Drupal core to the new routing system. Over this time, we've made some really great progress -- 122 conversion patches have already been committed!

However, we still have about 100 conversions left to go. In order to expedite the removal of the old routing system, the core and routing system maintainers have agreed to shift to a two-step conversion process.

New routing system conversion process

For each page and form callback, we will:

  1. Create the new route:
    • Add a route definition (in the modulename.routing.yml file)
    • Add a ModulenameController extending ControllerBase class if one doesn't exist yet (or ModulenameForm extending FormBase for forms).
    • Add a method to the controller that loads the file containing the existing form or page callback and calls it.
    • Mark the existing form or page callback deprecated.
    • Remove 'page callback' and the other legacy routing keys from the hook_menu() entry.
  2. Clean up the controller:
    • Move the code into the new controller method and remove the procedural callback.
    • Remove the dependency on the module file or include
    • Refactor the controller method for dependency injection and best practices.

Up to this point, we have done both steps in a single patch. Going forward, we will do step 1 first, and then do step 2 as a separate followup patch.

Example routing conversion patch using the old strategy: https://drupal.org/node/1987802#comment-7824587 (32 KB patch)
The same patch with the new strategy: https://drupal.org/node/2085893 (5 KB patch)

Why not continue on as we have been?

The advantage of the two-step process is that we can do step 1 for every module very quickly, and work on removing the Drupal 7 routing system so we can uncover and resolve critical issues with the new routing system as soon as possible. Step 2 requires more work and more careful technical review, and can continue after the old routing system is removed.

What about conversion patches that are already in progress?

Many routing conversions already have had a lot of work put into them. We will continue to review and commit these patches until September 14, 2013. At that point, the outstanding work should be split into two patches, one to commit that includes step 1 above, and a separate followup patch that includes any work for step 2 on the issue to date. While this will require some minor work to reroll existing patches into two separate patches, it will allow us to move forward with critical efforts at DrupalCon Prague.

Core

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: