Theme registery issues
hefox - August 5, 2009 - 20:12
| Project: | DraggableViews |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | closed |
Description
Perhaps to save some dummies like me some time put in the documentation that draggable views fails horrible if views is in two places (ie for me, sites/all/modules/contrib/views and modules/acquia/views). The rows don't appear for some reason. Though, I got it working once despite that.

#1
I think there's some cases where the view theme fails to register correctly (the row, view specific one that's registered for each draggable view) resulting in the rows not appearing (but the form does). Encountered the same symtoms as above, but this time clearing cache fixed it (before that didn't work). Tis odd.
#2
You're right. Every time a view gets created a new theme for its form becomes registered by DraggableViews. Unfortunately I couldn't find a hook that gets called when a view is saved.
Now I use
hook_views_pre_renderwhere I always check for the existence of the theme in the theme_registry. If it doesn't exist I cause the theme_registry to be rebuilt immediately.See http://drupal.org/cvs?commit=252182.
This seems to work pretty good for me.
Try and report,
greetings,
sevi
#3
Changing category to a bug report.
#4
Thanks; I knew about the different theme functions from when I was trying to figure out what was wrong xD; "hm... did I clear the cache... oops".
I'll try and test it when I can!
#5
I'm sorry :) I always try to reveal as many details as I can find in my brain when I answer an issue.
That's just like a memo for myself. It helps me to resume my thoughts whenever I revisit this issue.
#6
(Sorry I made you say sorry! didn;'t mean to phrase it like it got phrased I guess, more as an XD than a :
#7
I also found this issue after investigating why a panel we're building that includes several views was causing a lot of theme registry rebuilds.
Glad it has been addressed, but I'm wondering if it is really needed to generate so many theme entries in the registry. I think you could just create one, and give it the view name, display_id as arguments, or you can tweak the template preprocess function to generate candidate names for templates using view name, display id, and whatever else it could be needed.
#8
I've searched and tried so hard to reduce the number of registered themes - at the time I wrote this code without any success.
Help is very appreciated.
If someone gave me a hint how to accomplish this I would change the code immediately :)
Greetings,
sevi
#9
I believe this is pretty similar to the node edit form. The form_id is composed as node type + '_node_form'. In node_form() the $form['#theme'] attribute is assigned to a callback that renders node forms for any type. If it was needed, you could also store the reference to the view name and display id in the $form structure, for example as
$form['#draggableviews'] = array('view_name' = $view_name, 'display_id' => $display_id)or something similar.With this method it would be possible to have a single entry in theme registry for all draggableviews forms, each with its own form_id.
#10
Oh yeah, that's just how it should be.
It's actually a one-liner :)
Ouch, I should have hit on this too :\
Thanks for making everything so much easier :)
Maybe someone should have a look on my forms-stuff before I commit this patch.. I don't feel very familiar with forms yet.
Greetings,
sevi
#11
#12
I've tested the patch again and committed it to the DRUPAL-6--3 branch.
I let this issue open for a few days..just to be sure.
#13
that was time enough :)
#14
Automatically closed -- issue fixed for 2 weeks with no activity.