Skip to content
Open
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 src/Resources/themes/default/layout/layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<select class="form-control" id="version-switcher" name="version">
{% for version in project.versions %}
<option
value="{{ path('../' ~ version|url_encode ~ '/index.html') }}"
value="{% for i in project.version|split('/') %}../{% endfor %}{{ path(version|url_encode|replace({ '%2F': '/' }) ~ '/index.html') }}"
Copy link

@GuySartorelli GuySartorelli Mar 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend making a new template function in PHP-land.
That means:

  1. You can unit test the function
  2. Templates are easier to read - these templates are already pretty complicated
  3. If this same thing needs to happen elsewhere, the same function can be reused
  4. It's easier to make readable functional code in PHP than templates (imo)

data-version="{{ version }}" {{ version == project.version ? 'selected' : ''}}>{{ version.longname }}</option>
{% endfor %}
</select>
Expand Down