2

I have a module function which needs to get the raw results of a view, so I use this bit of code:

$view = views_get_view('sluitingsuren_bakker');
  $view->preview();

  return $view->result;

The views machine name is sluitingsuren_bakker. I also tried some other views, but it seems the module can't find any of the views.

Also I set my permissions on this view to none, because I thought that was the problem.

1 Answer 1

1

You are missing the display name, which is the machine name of the block/page.

You can find the machine name under Advanced settings in the right side of the view.

try:

   <?php 
    $view = views_get_view(view_name);
    $view->set_display(machine_name);
    $view->preview();
    return $view->result
    ?>

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.