Quick post: Drupal 8 paths

Last night I was working on some code for the Drupal 8 version of View Mode Page and ran into one conversion issue: the drupal_lookup_path function from Drupal 7 doesn’t exist in 8. I quickly searched around on api.drupal.org and with Google to try and find the updated info but couldn’t really find anything.

Eventually I landed on this change record which details how the path system is changing and this filled in the pieces that I was missing from looking at the code:

Drupal::service('path.alias_manager.cached')->getSystemPath('alias');
Drupal::service('path.alias_manager.cached')->getPathAlias('source');

I’d be interested to find out more about Drupal::service() and am also interested in figuring out a way to keep some of these changes manageable for the transition to D8.