Views Sort Expression allows you to add an SQL expression as a sort handler in
your View. This is an advanced module that requires knowledge of SQL and how to construct expression-based ORDER BYs.
It aims to be a helper module to achieve custom ordering that is normally not
possible with the regular sort handlers or that are not covered by existing
modules.
By sorting by an expression you can do things like showing NULL items last when
sorting by a numeric field, or creating a custom sort order putting some content
types on top. The possibilities are endless.
You may use whatever is you have currently available on the query. For that
reason you should always enable the "Show the SQL query" on the Views's setting
page. Normally, adding a field or the like doesn't necessarily add to the SQL
query, so you may find useful adding whatever is you want to use and inside
the expression as a sort in the end, and put your expression where you need it.
Installation
- Install this module using the official Backdrop CMS instructions at
https://docs.backdropcms.org/documentation/extend-with-modules.
Usage
- Click to 'Add' a 'Sort Criteria'
- Search for 'Expression' or filter by 'Global'
- Select and add the sort criteria.
Advanced documentation will be added here:
https://docs.backdropcms.org/documentation/add-ons/views-sort-expression
Issues
Bugs and Feature Requests should be reported in the Issue Queue:
https://github.com/backdrop-contrib/views_sort_expression/issues.
Current Maintainers
- Martin Price - System Horizons Ltd
- Collaboration and co-maintainers welcome!
Credits
- Ported to Backdrop CMS by - Martin Price - System Horizons Ltd.
- Port and ongoing development sponsored by System Horizons Ltd.
- Originally written for Drupal by Ariel Barreiro
License
This project is GPL v2 software.
See the LICENSE.txt file in this directory for complete text.