Bachir Soussi Chiadmi 1bc61b12ad first import
2015-04-08 11:40:19 +02:00

31 lines
916 B
JavaScript

(function ($) {
namespace('Drupal.media.browser.plugin');
Drupal.media.browser.plugin.upload = function (mediaBrowser, options) {
return {
/* Abstract */
init: function () {
tabset = mediaBrowser.getTabset();
tabset.tabs('add', '#upload', Drupal.t('Upload'));
mediaBrowser.listen('tabs.show', function (e, id) {
if (id == 'upload') {
// We only need to set this once.
// We probably could set it upon load.
if (mediaBrowser.getActivePanel().html() == '') {
mediaBrowser.getActivePanel().html(options.uploadForm);
}
}
});
}
};
};
// For now, I guess self registration makes sense.
// Really though, we should be doing it via drupal_add_js and some settings
// from the drupal variable.
// @todo: needs a review.
Drupal.media.browser.register('upload', Drupal.media.browser.plugin.upload, {});
})(jQuery);