Drupal Association members fund grants that make connections all over the world.
\Drupal\Core\Routing\PathBasedGeneratorInterface previously supplemented rather than inherited from the Symfony's
UrlGeneratorInterface, so while it was being used as a type hint in places, it was actually not covering all the methods that might be called.
This change replaces it with
\Drupal\Core\Routing\UrlGeneratorInterface, which should be used for type hinting in any Drupal code requiring Drupal-aware url-generation from routes or (deprecated) system paths.
In addition, the interface and class define generateFromRoute(), which takes an options array like
url() does. This brings URL generation for routes to parity with system paths, and allows a developer to specify a language (e.g. for path prefixing), a
This method is available also as a shortcut on the Drupal object,
Drupal::url(), which can be used e.g. in place of url() in procedural code when you need a path for a named route:
t('Visit the <a href="@url">content types</a> page', array('@url' => url('admin/structure/types')));
t('Visit the <a href="@url">content types</a> page', array('@url' => Drupal::url('node_overview_types')));
Note that calling
Drupal::url() is the same as calling