Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#7 | views.module_26.patch | 2.2 KB | yched |
#3 | views.module_25.patch | 986 bytes | yched |
#2 | views.module_24.patch | 848 bytes | yched |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedYep, it should be passed in to theme_view. Patches accepted. [someone contributed this function as a patch].
Comment #2
yched CreditAttribution: yched commentedpatch 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...
Comment #3
yched CreditAttribution: yched commentedActually, 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.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedif $type == 'block' you want to use nodes_per_block instead of nodes_per_page.
Otherwise I am good with this patch.
Comment #5
yched CreditAttribution: yched commentedNew patch (against 4.7--1.1) as per you latest remark
Comment #6
merlinofchaos CreditAttribution: merlinofchaos commentedI think the patch did not get attached?
Comment #7
yched CreditAttribution: yched commentedYes, that's 3 times in a row for me - should I consult ?
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted. Thanks for your patience!
Comment #9
(not verified) CreditAttribution: commented