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.
Is there a way to react on changes of views?
My problem:
DraggableViews module needs to register a theme for each View and display (because it wraps a form around the view output).
When a view gets saved a cache_clear_all
is performed, but the theme_registry stays unaffected.
I would also need to remove some entries from the database when a view gets deleted.
A hook_viewsapi
similar to hook_nodeapi
would be great.
Thank,
sevi
Comment | File | Size | Author |
---|---|---|---|
#11 | views-551808-11-Provide-hook_save_delete.patch | 2.3 KB | geek-merlin |
Comments
Comment #1
esmerel CreditAttribution: esmerel commenteddereine - is this maybe in 3.x? If not, postpone it and unassign it :D
Comment #2
dawehnerIt's not in 3.x but here is a patch
Comment #3
bojanz CreditAttribution: bojanz commentedI like the idea.
However, would like to see some advanced help documentation on this (which I can provide)
Comment #4
dawehnerAllow views_save/delete to alter the view. Also added some documentation and docs/docs.php
Comment #5
dawehnerComment #6
merlinofchaos CreditAttribution: merlinofchaos commentedOne question: Have you considered how this will play with exported views? Exports are one of the reasons I have resisted adding these hooks.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedYeah. No answer and I think it's because it's unanswerable. These hooks won't work due to exporting. I realize it's a pain in the butt, but that's the way it is.
Comment #8
heylookalive CreditAttribution: heylookalive commentedHi, was wondering if over the course of a few years that anything has come up that would make this more possible?
Comment #9
geek-merlinHmm, if i get it right, this is still not possible in 7.x.
Daring to raise prio.
Did not check 8.x (core) yet.
Comment #10
geek-merlinHmm, code is straightforward, should be trivial to port.
Comment #11
geek-merlinTrivial patch flying in that fixes this issue for me.
I need this for an upcoming contrib module and tested it worksforme.
Merlins #7 is no longer an issue in D7, i tested that a feature revert triggers the delete hook.
Comment #12
PolI'm also willing to have those hooks.
Comment #13
dawehnerCommitted this to views 7.x-3.x
One reason why this makes sense is that this adds some more symmetry between Views 7 and Views 8.
Comment #15
PolAnd 1:31 later it was fixed!
Thanks Daniel !!!!