looking at the code

function theme_view( $view_name, $limit = 0, $use_pager = false, $type = 'embed' ) {
  if ($view = views_get_view($view_name)) {
    return views_build_view($type, $view, $view_args, $use_pager, $limit);
  }
}

I don't understand where the $view_args param is supposed to come from ?
Shouldn't that be added as an additional argument of the theme_view function

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Yep, it should be passed in to theme_view. Patches accepted. [someone contributed this function as a patch].

yched’s picture

Title: theme_views : missing parameter ? » theme_view : missing parameter ?
Status: Active » Needs review
FileSize
848 bytes

patch attached

I kept the order of the arguments in order not to break anything, but since theme_view is just a wrapper for views_build_view, it would probably make more sense to have the arguments in the same order for both functions...

yched’s picture

FileSize
986 bytes

Actually, I sort of reworked this theme_views function :
Currently, it only takes into account the parameters (limit, use pager) that are passed to the function, discarding the fact that the view already contains settings for these.
If no params are provided, the limit = 0 and pager = false are used (which is now quite a bad default - all nodes, no pager !), instead of the "inner" views values

So I think it makes more sense to have the params override the views default settings, and let the default settings apply if no arguments are provided.

I'll provide an update for the function documenttion if you agree with the patch.

merlinofchaos’s picture

if $type == 'block' you want to use nodes_per_block instead of nodes_per_page.

Otherwise I am good with this patch.

yched’s picture

New patch (against 4.7--1.1) as per you latest remark

merlinofchaos’s picture

I think the patch did not get attached?

yched’s picture

FileSize
2.2 KB

Yes, that's 3 times in a row for me - should I consult ?

merlinofchaos’s picture

Status: Needs review » Fixed

Committed. Thanks for your patience!

Anonymous’s picture

Status: Fixed » Closed (fixed)