Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Helllooo!
I'm having trouble creating a view that sorts by content type! I can only get views to order by the content type's machine name instead of the human readable name. Is there something I'm missing?
Maybe I make a custom handler?
k' thanks bye!
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedViews is only able to sort by data that's actually in the database, which is the machine name. The human readable name is stored elsewhere and translated only upon display. It is not possible to sort by the human readable name with Views at this time.
Comment #2
terbs CreditAttribution: terbs commentedI was able to accomplish this using a custom module and views handler, for anyone that's curious. Node type human names are stored in the database in the node_type table.
Below is the query portion of the module.
Comment #3
fourmi4x CreditAttribution: fourmi4x commentedI also stumbled upon this problem.
For those interested in an alternative approach, I used a custom module as simple as:
c_views.module file:
c_views.views.inc file: