Skip to content
Drupal 8 | Alter comments query to order by DESC as well as the default ASC.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
sortcomments.info.yml
sortcomments.module

README.md

sortcomments

Example module to change the sort order of comments in Drupal 8 using function hook_query_TAG_alter. It is possible to configure sort order (newer or older first) per comment field, using the "comment field configuration" in "manage fields and settings" for your content type.

Corresponding issue for Drupal 7:

=> https://www.drupal.org/node/1095656

Drupal 8.2.x database.api.php / Perform alterations to a structured query for a given tag:

=> https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%21database.api.php/function/hook_query_TAG_alter/8.2.x

Advanced comment field configuration

configuration

Preview

preview sort flat

sort_flat

preview sort threaded

sort_threaded

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.