This patch add this new features in the line of the popups module:
- optionally adds the automodal js/css, this way hook_init avoid loading the automodal css and js on every page.
- the automodal can be activated (if no auto scan active) calling from any custom module the function automodal_add_automodal();
- This automodal_add_automoda() can be called defining a new selector and defining new default settings for the modalframe.
This way in a custom module you can change a link with a hook_link_alter adding the automodal with a specific configuration and over a new-defined or existing selector
format: automodal_add_automodal('.new_selector', array('with settings'));
-The javascript takes the modalframe settings and selector from the module and it's applied just once
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | automodal-allow_functions-767128-2.patch | 533 bytes | Vector- |
| #11 | automodal-hook_automodal-767128-1.patch | 1.67 KB | Vector- |
| #14 | automodal-allow_functions-767128-1.patch | 491 bytes | Vector- |
| #13 | automodal-multiple_selectors-767128-3.patch | 595 bytes | Vector- |
| #12 | automodal-multiple_selectors-767128-2.patch | 509 bytes | Vector- |
Comments
Comment #1
jcmarco commentedComment #2
jcmarco commentedAdded extra check for js in the hook_init
Comment #3
jcmarco commentedForget patch in #2, it has problems using Pressflow and memcache.
Comment #4
jcmarco commentedNow you can add different selectors with different settings each
Just use automodal_add_automodal($arraywithsettings, '.automodal_2');
Comment #5
troyl commentedthis patch is not working and no modalframes are called anymore...so reverting back to the last dev one
Comment #6
jcmarco commentedHave you tested #4? I have it in a local devel server and it works fine.
I have created two different classes with different settings, and it launches the different modalframes with the links.
I was using popups before and I am trying to get the 'same' behavior but with modalframe.
If it has problems so I will forget this patches and I will run it in a custom module, maybe nobody is interested in
trying to 'migrate' popups behavior to modalframe, this module could easily be a 'transparent' migration to
modalframe.
Comment #7
troyl commentedI am interested in ModalFrame and your module gives a nice bridge for people without coding knowledge to work with ModalFrame, however, I will test the #4 Patch again and I would let you know.
Comment #8
danny englanderI tried the patch in #4 and got this message:
I can post the .rej file's code if anyone is interested
Comment #9
keva commentedsame problem as #8.
contents of automodal.js.rej:
Comment #10
Vector- commentedFor the people who are having trouble applying this patch...
Have you applied the fix at #769426: IE 7 script error ?
That fix would cause this patch to not apply cleanly, and it's the only thing I see in the issue queue that might cause this?
To fix the patch locally, one should only have to apply the same change to the patch itself as applied to automodal.module (remove the trailing comma in settings)
Comment #11
Vector- commentedNote: All of the following patches I've posted depend on patch in #4
http://drupal.org/node/767128#comment-2833562
Along the lines of porting features from Popups UI, I've put this together...
This patch adds a hook_automodal() that functions almost identically to hook_popups()
(I copied most of the implementation from Popups UI directly, with a few changes to suit automodal)
If you're considering using these features, you might also want to check #685364: close modal on form submit
The combination of these two patches (and possibly the one below, still not sure if that's going to be applicable for most people) should allow very easy porting of existing Popups UI reliant modules.
Comment #12
Vector- commentedEDIT: Using a RegExp in JavaScript just feels dirty... all the rest of the rambling below applies, but don't use this patch!
And I ran into a problem with '/'s in selectors - they weren't getting escaped properly...
I'd be very interested in knowing if other people get errors related to this when trying to add a selector containing a '/' (ex a[href*=path/to])
(FireFox was reporting something along the lines of "Expected selector to end with ] found /")
I would be particularly interested in knowing if anyone else has this problem, however - because I'm very suspicious that this could be a local bug related to jQuery 1.8
(which, of course, is not AT ALL supported in D6... so if it's a local problem only, I'll probably think on other ways to fix this)
Comment #13
Vector- commentedAnother attempt to fix the selector encoding, this one feels a bit less dirty
Still not sure if this is a jQuery 1.8 related problem or not...
Comment #14
Vector- commentedAnd another patch, this one adds the ability to parse functions from strings in settings.onSubmit
This patch depends on http://drupal.org/node/685364#comment-3129642 - but wouldn't be difficult to reroll...
Comment #15
Vector- commentedpatch in #14 needs a sanity check - other modules (Autoload, I think) might have already done the work for us.
Try that again:
Comment #16
mfer commentedsubscribe. Will look into this soon.
Comment #17
mfer commented@Vector for the new function piece why aren't you adding the function via js and calling it?
Comment #18
mfer commented@Vector The more I look at it the more I see to problems with what you posted.
The one place I could see a hook is hook_automodal_alter that passes in a selector and settings. Giving other modules an option to alter the settings for the selector. But, that would need to be another issue all together.
Comment #19
mfer commentedCode based on #4 has now landed. http://drupal.org/cvs?commit=408872
For details see the API.txt file and the new function automodal_add().
Also, the default for the autoscan is on. This will preserve backwards compatibility for a number of sites.
There is, also, a hook_automodal_alter.
I would love testers of this.
Comment #20
keva commentedThis seems like a stupid question, but I'm used to testing patches: Is the new code to test to be found in 6.x-1.x-dev (Aug 17 2010)? Or do we pull it from the CVS link in #19?
Comment #21
Iagoo commentedplease somthing about that??
http://drupal.org/node/872352
thanks
Comment #22
mfer commented@keva This is now in 6.x-1.x-dev. When I'm working on modules I do not tend to use patches as they slow down the process. I only work with patches on other peoples modules and core.
Comment #23
keva commentedThanks mfer - I'll test in the next couple of days.
Comment #25
Vote_Sizing_Steve commentedWhere do I find the value for this 'selector'? Here's the php code I use to invoke an automodal link on my page:
... but the module 'reverts' to the default values. (The Wrap_HTML function just puts < a../a > tags around the values passed to it.)