Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MYMODULE_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
- if($view->id() == 'myview'){
- foreach ($query->where as &$condition_group) {
- foreach ($condition_group['conditions'] as &$condition) {
- if ($condition['field'] == "node_field_data.nid") {
- $condition = array(
- 'field' => "node_field_data.nid",
- 'value' => [2,4,6,1,3,5],
- 'operator' => 'in',
- );
- break;
- }
- }
- }
- //this does not work
- //$query->addOrderBy('node_field_data','nid', 'ASC', '', [2,4,6,1,3,5]);
- }
- }
Add Comment
Please, Sign In to add comment