- 🇨🇦Canada jigarius Montréal
Thanks for the suggestion but I believe this module will go away sometime soon. Please follow this issue to stay up-to-date 💬 Deprecate the Sidr module in favor of another project Needs work .
I needed to execute my own code when Drupal.Sidr fires it's onOpen and onCloseEnd events that are configured in sidr/sidr.js @ Drupal.behaviors.sidr_trigger.
N/A
I've patched modules/contrib/sidr/sidr.js to allow extension of Drupal.Sidr with a "cb" property. The Drupal.Sidr.cb property is an object that defines one or more of the following callbacks: onOpen, onOpenEnd, onClose, onCloseEnd.
Each callback that you define is passed the sidr trigger (it's jQuery~fied dom node) as it's first argument and the triggers settings (a js object) as it's second argument.
Here's an example defining two callbacks: onOpen and onCloseEnd:
_.extend(Drupal.Sidr,{ cb: {
onOpen: function(trigger,settings){
console.log({'@':'onOpen', trigger: trigger, settings: settings});
},
onCloseEnd: function(trigger,settings){
console.log({'@':'onCloseEnd', trigger: trigger, settings: settings});
},
}});
I've attached the patch file for sidr v3.1.0 → and my patched version of the sidr.js file → (remove the _.txt extension)
Usage Notes:
The above example could be placed anywhere that has Drupal.Sidr already defined, and since it's using underscore.js (included in core) to splice the cb property into Drupal.Sidr, also has _ defined.
Let’s say the above _.extend() is placed in the file: your_module/sidr-callbacks.js. To make sure that you had Drupal.Sidr and _ already defined, your libraries file (your_module/your_module.libraries.yml) would look something like:
your_library:
js:
'sidr-callbacks.js': {}
dependencies:
- core/underscore
- sidr/behaviors
??
N/A
N/A
N/A
Closed: won't fix
3.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Thanks for the suggestion but I believe this module will go away sometime soon. Please follow this issue to stay up-to-date 💬 Deprecate the Sidr module in favor of another project Needs work .