twig_theme_test.url_generator.html.twig in Drupal 9
{# Test the url and path twig functions #}
<div>path (as route) not absolute: {{ path('user.register') }}</div>
<div>url (as route) absolute: {{ url('user.register') }}</div>
<div>path (as route) not absolute with fragment: {{ path('user.register', {}, {'fragment': 'bottom' }) }}</div>
<div>url (as route) absolute despite option: {{ url('user.register', {}, {'absolute': false }) }}</div>
<div>url (as route) absolute with fragment: {{ url('user.register', {}, {'fragment': 'bottom' }) }}</div>
File
core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_generator.html.twig
View source
- {# Test the url and path twig functions #}
- <div>path (as route) not absolute: {{ path('user.register') }}</div>
- <div>url (as route) absolute: {{ url('user.register') }}</div>
-
- <div>path (as route) not absolute with fragment: {{ path('user.register', {}, {'fragment': 'bottom' }) }}</div>
- <div>url (as route) absolute despite option: {{ url('user.register', {}, {'absolute': false }) }}</div>
- <div>url (as route) absolute with fragment: {{ url('user.register', {}, {'fragment': 'bottom' }) }}</div>