I am using KNPPanginator Bundle, and pretty satisfied with it.
But i cannot find out, how to replace my sorters at the top, with icons instead of text. Here is my Twig code:
{% block pagination_head %}
<thead>
<tr>
<th>{{ pagination.sortable('likes', 'u.likePoints')|raw }}</th>
<th>{{ pagination.sortable('title', 'u.title')|raw }}</th>
<th>{{ pagination.sortable('date', 'u.created')|raw }}</th>
</tr>
</thead>
{% endblock %}
So what do i need to do, to get a thumps up icon, instead of the word “like”?
i tried pasing an <img src...> in there, but did not help.
Well, first of all you need to have an image asset of a thumb-up. Let’s say you do get one and put it here:
web/images/like.pngThen all you need to do is this (assuming
pagination.sortable('likes', 'u.likePoints')returns the string “like”):Of course, you’ll probably want to put the image resource in your bundle and publish it with
assets:install web, for encapsulations/organizational purposes.EDIT
There are a lot of ways to solve what you’re talking about. One would be to make a macro.
In Your\Bundle\Resources\views\Macros\bootstrap.html.twig
Then, in the template you need it in