ISSUE:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "path.alias_manager". Did you mean this: "path_alias.manager"? in Drupal\Component\DependencyInjection\Container->get() (line 156 of core\lib\Drupal\Component\DependencyInjection\Container.php).
Drupal::service('path.alias_manager') (Line: 53)
Solution:
Drupal 9
change path.alias_manager in to path_alias.manager in D9, That's it.
$current_path = \Drupal::service('path.current')->getPath();
$result = \Drupal::service('path_alias.manager')->getAliasByPath($current_path);
- 60 views
Add new comment