admin管理员组文章数量:1310283
New to WP development here so please bear with me if I'm missing something simple...
I am writing a plugin for the Media upload library which needs to get the selected media items in Grid View (for drag & drop). I know that the items in the media grid are dynamically generated, so I'm trying to extend the AttachmentsBrowser, and get those elements there during initialize()
. However, initialize()
is never called.
!function(e) {
var i = {
init: function() {
console.log("This is called");
wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
initialize: function () {
console.log("This is NOT called.");
},
});
}
}
e(document).ready(function() {
i.init()
})
}(jQuery);
I've checked that wp.media.view.AttachmentsBrowser exists. But somehow initialize()
doesn't appear to get called. Is there something else that I need to add?
New to WP development here so please bear with me if I'm missing something simple...
I am writing a plugin for the Media upload library which needs to get the selected media items in Grid View (for drag & drop). I know that the items in the media grid are dynamically generated, so I'm trying to extend the AttachmentsBrowser, and get those elements there during initialize()
. However, initialize()
is never called.
!function(e) {
var i = {
init: function() {
console.log("This is called");
wp.media.view.AttachmentsBrowser = wp.media.view.AttachmentsBrowser.extend({
initialize: function () {
console.log("This is NOT called.");
},
});
}
}
e(document).ready(function() {
i.init()
})
}(jQuery);
I've checked that wp.media.view.AttachmentsBrowser exists. But somehow initialize()
doesn't appear to get called. Is there something else that I need to add?
1 Answer
Reset to default 0Turns out the reason this happened is because when I registered/enqueued the script, I had in_footer = true
. Setting this to the default of false
solved the problem.
本文标签: Not able to extend wpmediaviewAttachmentsBrowser
版权声明:本文标题:Not able to extend wp.media.view.AttachmentsBrowser 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741789722a2397588.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论