aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAMoQu <[email protected]>2015-11-16 13:00:34 +0100
committerVictor Häggqvist <[email protected]>2015-11-17 17:26:25 +0100
commitf9be3024b81f2d272ad59649ce37c2ec0e7ac04b (patch)
treed794c727447f39089ef7f86566e436386646f9fb
parent452c4d0c6fd898245f7db68d00db64922d028be5 (diff)
feat: support sorting of non-numeric indexed parent arrays
-rw-r--r--src/SortByFieldExtension.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/SortByFieldExtension.php b/src/SortByFieldExtension.php
index 8af21f5..144a383 100644
--- a/src/SortByFieldExtension.php
+++ b/src/SortByFieldExtension.php
@@ -34,7 +34,7 @@ class SortByFieldExtension extends \Twig_Extension {
throw new \InvalidArgumentException('Variable passed to the sortByField filter is not an array');
} elseif ($sort_by === null) {
throw new Exception('No sort by parameter passed to the sortByField filter');
- } elseif (!self::isSortable($content[0], $sort_by)) {
+ } elseif (!self::isSortable(current($content), $sort_by)) {
throw new Exception('Entries passed to the sortByField filter do not have the field "' . $sort_by . '"');
} else {
// Unfortunately have to suppress warnings here due to __get function