diff options
author | Victor Häggqvist <[email protected]> | 2016-01-27 01:27:35 +0100 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2016-01-27 01:27:35 +0100 |
commit | 36ed485f1a82c9a382b5ca63da60a73429f85921 (patch) | |
tree | fb702d895ddae6f1793cec673b93836b5b73879d /README.md | |
parent | 5d147de5db3679fefd6afa70149a5a454a52b015 (diff) |
update readmecollections
Diffstat (limited to '')
-rw-r--r-- | README.md | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -1,12 +1,14 @@ # Twig SortByField Extension [![](https://img.shields.io/travis/victorhaggqvist/Twig-sort-by-field.svg?style=flat)](https://travis-ci.org/victorhaggqvist/Twig-sort-by-field) A Twig Extension filter to sort an array of entries (objects or arrays) by an entry field. +Since version 0.1.5 Doctrine collections can be sorted as is with no need to manually extract the array first. + ## Install With composer composer require snilius/twig-sort-by-field -## Sample +## Usage The list could look like this, but obviously with more than one key per array. ```php @@ -34,6 +36,17 @@ $base = array( {% endfor %} ``` +For Symfony usage you'll want to add it as a service and tag it for Twig. + +```yml +# app/config/services.yml +services: + twig.extension.sortbyfield: + class: Snilius\Twig\SortByFieldExtension + tags: + - { name: twig.extension } +``` + ## License Copyright 2015 Victor Häggqvist |