diff --git a/plugins/Directory/Controller/Directory.php b/plugins/Directory/Controller/Directory.php index f786002b15..9cddd0b06a 100644 --- a/plugins/Directory/Controller/Directory.php +++ b/plugins/Directory/Controller/Directory.php @@ -129,11 +129,26 @@ class Directory extends FeedController }; // -------- *** -------- + $sort_options = []; + foreach (self::ALLOWED_FIELDS as $al) { + $sort_options[] = [ + 'active' => false, + 'url' => '?order_by=' . $al . '^', + 'label' => _m('{order_by} ascending', ['{order_by}' => ucfirst($al)]), + ]; + $sort_options[] = [ + 'active' => false, + 'url' => '?order_by=' . $al . 'v', + 'label' => _m('{order_by} descending', ['{order_by}' => ucfirst($al)]), + ]; + } + return [ '_template' => 'directory/actors.html.twig', 'actors' => $query_fn($actor_type), 'title' => $title, 'empty_message' => $empty_message, + 'sort_options' => $sort_options, 'page' => $page, ]; } diff --git a/plugins/Directory/templates/directory/actors.html.twig b/plugins/Directory/templates/directory/actors.html.twig index be73125ff3..d9f9b8e1b9 100644 --- a/plugins/Directory/templates/directory/actors.html.twig +++ b/plugins/Directory/templates/directory/actors.html.twig @@ -6,6 +6,13 @@

{{ title }}

+
+

{% trans %}Sort by:{% endtrans %}

+ {% for option in sort_options %} + {{ option.label }} + {% endfor %} +
+
{% if actors is defined and actors is not empty %} {% for actor in actors %}