Closed (fixed)
Project:
Views random seed
Version:
8.x-1.0-alpha1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2018 at 15:56 UTC
Updated:
5 May 2021 at 13:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
zero2one commentedThe current session is now retrieved (using Dependency injection) from the injected requestStack.
Don't access services using \Drupal::service() in classes, it makes it hard/impossible to write unit tests.
Comment #3
zero2one commentedThe second problem with the suggested patch is that you create a hard link between the views_random_seed module and the Search API module. So you can no longer install the views_random_seed without the Search API module…
I fixed the missing random sort functionality by implementing the hook_views_query_alter().
A permanent fix should be a custom views sort plugin?
Comment #4
NewZeal commentedThanks SageSolutions, for the awesome patch. I tried it on 8.x-1.0-alpha1 but it failed to fire. The patch is expecting different code. So attached is a rewrite for 8.x-1.0-alpha1 that works for me. Also injects that session service and removes logger.
Comment #5
maskedjellybeanIf anyone needs to combine this with https://www.drupal.org/project/views_random_seed/issues/2860769#comment-..., the attached patch will work for 8.x-1.0-alpha1.
Comment #6
mathiasgmeiner commentedI've had to change the
getSession()part to be able to apply the patch #5from
to
Comment #8
swentel commentedcommitted and pushed (with slight changes)
Available in dev!
Comment #9
swentel commented