The example for hook_views_default_views_alter would cause a fatal error if used with views caching enabled (which in general it is). (The error happens various times, like when reverting views, etc).

Replaced with an example that does the same but shouldn't cause that error to my understanding.

CommentFileSizeAuthor
hook_views_default_views_alter_doc.patch506 byteshefox
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

looks fine

hefox’s picture

Status: Reviewed & tested by the community » Needs review

A note on the documentation is that hook and several others do not mention what files they could be put in and auto loaded. This hook works in the module.views.inc (and likely the .views_default.inc for this one). hook_views_pre_render is another that can work in .views.inc.

dww’s picture

Assigned: Unassigned » dww
Status: Needs review » Needs work

As per an IRC debugging session with Earl, if you do anything fancy in here, you also need to call $view->destroy(). I'll try to give this some love based on my newfound knowledge of how this all works... Stay tuned.

esmerel’s picture

Assigned: dww » Unassigned

I'm gonna bet dww doesn't have much time to work on this. I'm going to unassign it, and if anyone can/will take it up, that would be useful :)

hefox’s picture

There was actually a duplicate of this, #910990: Improve documentation of hook_views_default_views_alter() example that got committed (basically same patch as first I think).

However, the new understanding of views destroy likely should be added. (was trying to remember about views->destory and found the other issue first)

MustangGB’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)