Is it possible for a module to insert custom values into the body tag of a dynamic view page? I'm trying to write my own version of a google maps module, and I need to insert onload="initialize()" into the body tag to make the map load automatically (right now I've got a "click here to load the map" link instead). Is there a way to do that?
Posts: 16504
I don't know how, but it looks like that stuff is inserted into the theme:
See /themes/default/views/page.html.php
<body <?= $theme->body_attributes() ?>>
That function is defined in /modules/gallery/libraries/MY_View.php
And right now it looks like it's not doing anything other than checking if you have a right-to-left language and if so, sets a class for that.
I don't know how to extend that, but you're the plugin machine so maybe you can't figure that out. And share it with me
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 722
I saw that function call too, but it doesn't take any variables
Oh well, it works well enough with the "Load Map" button. If I can't figure something out before I finish the rest of the code maybe I'll load the map inside of an iframe or something.
Posts: 27300
You can call initialize from within the code, you don't need to do it from the onLoad() in the body tag.
See if this works:
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 722
Yes that works, thanks
Posts: 7994
Just in case, I just tweaked the code to allow modules to add their own hooks in your xxx_theme helper so that you can override body_attributes.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git | help! vote!