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.
I'm using EFQ to create a user entity view with support for my custom user view mode. I would like to output the user rows randomly, but upon adding a sort criteria of 'Global: Random' the following error occurs:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /admin/structure/views/view/people_tiles/preview/default/ajax
StatusText: OK
ResponseText:
( ! ) Fatal error: Call to undefined method efq_views_plugin_query::add_orderby() in /Applications/XAMPP/xamppfiles/htdocs/tng-thenewgroup-com/sites/all/modules/contrib/views/handlers/views_handler_sort_random.inc on line 8
Call Stack
#TimeMemoryFunctionLocation
10.0002374764{main}( )../index.php:0
22.328543609024menu_execute_active_handler( )../index.php:21
32.328643609520call_user_func_array
( )../menu.inc:503
42.328643609740views_ui_build_preview( )../menu.inc:0
52.339843719948views_ui_preview( )../admin.inc:935
62.361745039612view->preview( )../admin.inc:158
72.364245126484views_plugin_display->preview( )../view.inc:1116
82.364245126512view->render( )../views_plugin_display.inc:2452
92.364245126540view->execute( )../view.inc:973
102.364245126540view->build( )../view.inc:917
112.365245133520view->_build( )../view.inc:841
122.365345133648views_handler_sort_random->query( )../view.inc:907
Comment | File | Size | Author |
---|---|---|---|
#2 | user-row-style.jpg | 88.4 KB | anniegreens |
#2 | content-row-style.jpg | 80.18 KB | anniegreens |
#2 | content-row-style-options.jpg | 85.42 KB | anniegreens |
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedEntityFieldQuery doesn't support order by rand() so there's no way to support that.
Gonna try to unset it at least.
That said, you don't need efq_views just to show an entity with a custom view mode, you can do that with the "Entity View" style (just like there's a "Node view" one for nodes, instead of "Fields") provided by Entity API.
Comment #2
anniegreens CreditAttribution: anniegreens commentedThanks, but that was what I originally tried. I have several node views with custom view modes and this method is not available for a user view. Unless I'm misunderstanding what you are saying.
Row options for a user view, regardless of format, is fields or panel fields (with panels installed). There is no option, as with nodes to choose Content (or Entity as you suggest) and then select a view mode. I was viewing an issue regarding this when I came across someone's suggestion to use efq_views, although I cannot seem to find the issue in my history to include it here.
Regardless, went with custom template files and am done with it now. But thanks for your reply.
Screenshots attached to show difference between options for row style with user/node.
Comment #3
bojanz CreditAttribution: bojanz commentedDo you have Entity API installed?
The entity row style should appear if Entity API is enabled.
(Sorry that it didn't work out)
Comment #4
anniegreens CreditAttribution: anniegreens commentedYes. I have entity API installed. It is required by another module I'm using. Perhaps I shall glance at the Entity API issue queue.
Thanks again!
Comment #5
chx CreditAttribution: chx commentedThis can't be done as said in #1