templates/user/settings/_stats_pills.html.twig
{%- set TYPE_CONTENT = constant('App\\Repository\\StatsRepository::TYPE_CONTENT') -%}
{%- set TYPE_VIEWS = constant('App\\Repository\\StatsRepository::TYPE_VIEWS') -%}
{%- set TYPE_VOTES = constant('App\\Repository\\StatsRepository::TYPE_VOTES') -%}
<div class="pills">
<menu>
<li>
<a href="{{ path('user_settings_stats', {username: app.user.username, statsType: TYPE_CONTENT}) }}"
class="{{ html_classes({'active': route_has_param('statsType', TYPE_CONTENT) or get_route_param('statsType') is same as null}) }}">
{{ TYPE_CONTENT|trans }}
</a>
</li>
<li>
<a href="{{ path('user_settings_stats', {username: app.user.username, statsType: TYPE_VOTES}) }}"
class="{{ html_classes({'active': route_has_param('statsType', TYPE_VOTES)}) }}">
{{ TYPE_VOTES|trans }}
</a>
</li>
<li>
<a href="{{ path('user_settings_stats', {username: app.user.username, statsType: TYPE_VIEWS}) }}"
class="{{ html_classes({'active': route_has_param('statsType', TYPE_VIEWS)}) }}">
{{ TYPE_VIEWS|trans }}
</a>
</li>
</menu>
</div>