Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use app global variable for current route #1563

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<body id="{% block body_id %}{% endblock %}">

{% block header %}
{% set _route = app.request.get('_route') %}
{% set _route = app.current_route %}
<header>
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-primary">
<div class="container">
Expand Down
2 changes: 1 addition & 1 deletion templates/default/_language_selector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{% set is_active = app.request.locale == locale.code %}
{% set is_rtl = locale.code in ['ar', 'fa', 'he'] %}
<li class="{{ is_active ? 'active' }} {{ is_rtl ? 'rtl' }}" translate="no">
<a class="stretched-link" lang="{{ locale.code }}" hreflang="{{ locale.code }}" href="{{ path(app.request.get('_route', 'blog_index'), app.request.get('_route_params', [])|merge({_locale: locale.code})) }}">
<a class="stretched-link" lang="{{ locale.code }}" hreflang="{{ locale.code }}" href="{{ path(app.current_route ?? 'blog_index', app.current_route_parameters|merge({_locale: locale.code})) }}">
{{ locale.name|capitalize }}
<small>{{ locale.code }}</small>
</a>
Expand Down