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.
I've got some troubles when use query aggregation.
First of all, there is notice message:
Notice: Undefined property: view::$dom_id в функции template_preprocess_views_view() (строка 116 в файле /usr/local/www/*****.ru/www/sites/all/modules/views/theme/theme.inc).
And the second - I use hook_views_pre_render(&$view) to override header area depends on current contextual filter argument. But there is no argument at all. =(
Comment | File | Size | Author |
---|---|---|---|
#9 | 1791304-9.patch | 436 bytes | jibran |
Comments
Comment #1
holdmann CreditAttribution: holdmann commentedHere some patch
Comment #2
holdmann CreditAttribution: holdmann commentedOops, some troubles with spaces and tabs
Comment #3
derhasi CreditAttribution: derhasi commentedI'm getting the same notice.
This seems to be a related issue: #1556174: $dom_id issues with upgrade
I'm currently investigating the module if there should be a $child_view->pre_execute() implemented, as dawehner stated in the mentioned issue. Simply adding the dom_id might not be enough.
Comment #4
marvil07 CreditAttribution: marvil07 commentedI am not sure what is the right solution here, so I propose several options to let maintainers, which are more familiar with the module decide. Notice all make the warning disappear.
Run $child_view->pre_execute()
This sounds like the more rational idea, since views maintainers mention on #1556174-10: $dom_id issues with upgrade that we should do that. Basically that method set dom_id in the right way.
Not sure yet what exactly to pass as argument, but it should not matter since we are not executing the child view when aggregation is used (is executed on
pre_render()
instead).The patch from comment 2
Set
$child_view->is_attachment
to TRUEThe mentioned warning happens on views theme/theme.inc when
$view->is_attachment
is empty, which is originally used to prevent attached views to show a dom_id, which they do not have.This is hack I guess, but setting it to TRUE by pass that template variable assignment, so it also seems to fix the problem.
Comment #5
marvil07 CreditAttribution: marvil07 commentedAfter a quick review Daniel mentioned if we should use
preview()
method.I think that method should not be used in that portion of views_field_view.
render()
method is used directly instead, so callingpreview()
does not make sense on the aggregate query option of views_field_view, which tries to avoid executing the query many times, and executes it once onpre_execute()
.Comment #6
damiankloip CreditAttribution: damiankloip commentedWell, yeah. preview will pre_render the view too. So Daniel wanted to just do something like this?
Comment #7
marvil07 CreditAttribution: marvil07 commented@damiankloip: Yes, and as mentioned, that doe snot make sense in the context of the vies_field_view aggregation option, so I am each time more convinced that the right solution is to run pre_execute() as the first patch on comment 4.
Comment #8
dawehnerAwesome!
Comment #9
jibranPatch for 8.x-1.x branch.
Comment #10
nicrodgersPlease can someone update the issue summary with steps to replicate?
Comment #11
nicrodgers