Support » Plugins » Hacks » WordPress 3.5 Media Gallery: Create my own Sidebar in Uploader

  • Hey!

    I am currently trying to utilize the new WordPress 3.5 media manager.

    What I want to do is: a user clicks upload button, media manager pops up, user selects image, presses insert, image is then saved to custom field.

    All of that already works, the only thing that I would like to change is to populate the sidebar of the media uploader (were user can add caption, title, select size, etc) with my very own template.

    I already read dozens of tutorials on how to work with backbone but am now a little stuck. here is my some of code so far:

    //defined earlier:
    var frame;
    //on click:
    if ( file_frame )
        // Create the media frame.
        file_frame  =
    	frame:   'select',
    	state:	 'mystate',
    	library:   {type: 'image'},
    	multiple:   false
    	new media.controller.Library({
    		id:         'mystate',
    		title: 'my title',
    		priority:   20,
    		toolbar:    'select',
    		filterable: 'uploaded',
    		library:    media.query( file_frame.options.library ),
    		multiple:   file_frame.options.multiple ? 'reset' : false,
    		editable:   true,
    		displayUserSettings: false,
    		displaySettings: true,
    		allowLocalEdits: true,
    	      //AttachmentView: ?

    I have also tried registering my own template like this:

    media.view.Attachment.mySidebar = media.view.Settings.AttachmentDisplay.extend(
    	className: 'attachment-display-settings',
    	template:  media.template('avia-choose-size')

    but the problem is: I dont know were to load only this template instead of the original sidebar. passing it as AttachmentView parameter obviously doesnt work since it replaces the whole template and not just the sidebar.

    Anyone with some backbone.js experience who can help?

  • The topic ‘WordPress 3.5 Media Gallery: Create my own Sidebar in Uploader’ is closed to new replies.