Skip to content

Instantly share code, notes, and snippets.

@DuaelFr
Last active October 14, 2016 21:17
Show Gist options
  • Select an option

  • Save DuaelFr/074a7611294dc2174da6af4aa22b8cc2 to your computer and use it in GitHub Desktop.

Select an option

Save DuaelFr/074a7611294dc2174da6af4aa22b8cc2 to your computer and use it in GitHub Desktop.
// Declaration globale.
window.MonHelper = {
function1: function (context, settings) { alert("truc de base"); }
};
(function ($, Drupal) {
"use strict";
Drupal.behaviors.TrucDuCore = {
attach: function (context, settings) {
MonHelper.function1(context, settings);
}
};
})(jQuery, Drupal);
(function ($, Drupal) {
// Surcharge de la fonction uniquement.
MonHelper.function1 = function (context, settings) { alert("truc surchargé"); };
// -OU- surcharge de behavior.
Drupal.behaviors.TrucDuCore = {
attach: function (context, settings) {
autre_truc();
}
};
})(jQuery, Drupal);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment