Skip to main content
11 events
when toggle format what by license comment
Apr 18, 2017 at 16:46 vote accept Matt Fletcher
Mar 6, 2013 at 9:32 answer added Matt Fletcher timeline score: 1
Mar 6, 2013 at 9:30 comment added Matt Fletcher Within hook_form, which is a menu page callback.
Mar 6, 2013 at 9:09 comment added Alice Heaton @MattFletcher - where do you call drupal_add_js in your server side code ? It is possible the problem comes from there. I have a module which calls it in hook_init, and my settings are available before attach is called.
Mar 5, 2013 at 17:08 comment added Matt Fletcher Thanks guys, worked it out myself. Until attach() is called, Drupal.settings doesn't contain my custom variables. I'll answer my own question later (not enough rep to do it before 8 hours! Bah..)
Mar 5, 2013 at 16:43 comment added Alfred Armstrong To make a function visible outside the scope, just make an assignment to an attribute of window, eg. window.myfunction = myfunction. Not recommended and may cause all sorts of new scoping issues, mind.
Mar 5, 2013 at 16:39 review First posts
Mar 5, 2013 at 19:54
Mar 5, 2013 at 16:37 comment added Matt Fletcher @AliceHeaton, thanks for your response! If I type Drupal.settings.myModule.initial_page into the console it gives my answer, but outside of the attach it doesn't seem to...
Mar 5, 2013 at 16:34 comment added Matt Fletcher Unless anyone knows how I can access a function within the attach function from a separate javascript file? Because that's what I'm essentially trying to do, but it seems impossible, unless I'm just an idiot...
Mar 5, 2013 at 16:33 comment added Alice Heaton I don't see where your error is, but Drupal.settings is definitely available outside the scope of the attach function. Just open FireBug console on a Drupal 7 site and type Drupal.settings - you will see that the object exists.
Mar 5, 2013 at 16:21 history asked Matt Fletcher CC BY-SA 3.0