Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Views Sort Expression

Security covered Maintenance fixes only 334 sites

Part of the Views ecosystem · 282 projects

This module allows for advanced sorting of view results using custom SQL expressions. It enables sorting options not available in default handlers, such as displaying NULL values last or prioritizing certain content types.

This is an advanced module as it basically requires you to know the SQL of the view and how to construct expression-based ORDER BYs.

It aims to be a helper module which provides custom ordering that is normally not possible with default sort handlers.

By sorting by expressions 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 currently available in the query. For that reason, you should always enable the "Show the SQL query" on the Views setting page to help you find the proper field aliases. Adding a field or the like to the view doesn't necessarily alter the SQL Query. You may find it useful to add what you need in the proper sort order, use it inside the expression, then rearrange your expression where you need it.

Drupal 9–11

Ask your assistant about Views Sort Expression

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • views Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Apr 2024
Latest release
1 month ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
2.0.2 Stable 9–11 Sep 8, 2026
2.0.1 Stable 9–10 May 9, 2024
2.0.0 Stable 9–10 Apr 21, 2024