Im using views 7.3

I have two views and tring to merge them both as outlined here https://drupal.stackexchange.com/a/212340/79382

I have created a module and included two files. foo_view_merge.info foo_view_merge.module

in the .module I have included the following

function foo_view_merge_views_pre_render(&$view) {
  if($view->name == 'foo_user_content' && $view->current_display == 'block') {
    $view2 = views_get_view('foo_flag_content'); //View Name
    $view2->preview('default'); //View Display
    //Check for empty results
    $view->result = array_merge($view->result, $view2->result);

I have enabled the module, and put the foo_user_content views block on one of my websites pages. However the block just shows the normal views results, the 2nd view does not get included.

What more do I need to do?

Thanks for any help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.