Of course they still work, but are not the “proper” way to add to the uploader now. The proper way would be to utilize the new Backbone system. However, I’m not familiar with this so that’s what I was asking. How do I add stuff using the new javascript API.
Perhaps my question should have been “Adding views to media uploader”. How would I do the following from a script of my own?
sidebar.set( 'compat', new media.view.AttachmentCompat({
controller: this.controller,
model: single,
priority: 120
}) );
I’m sorry but I have no Idea, I’ve never worked with Backbone before.
To add a template of your own to all other media templates with the action print_media_templates use something like this in your plugin or functions.php:
function add_my_media_view_template(){
// copied from wp-includes/media.php: tmpl-attachment-display-settings
?>
<script type="text/html" id="tmpl-my-attachment-display-settings">
<h3><?php _e('My Attachment Display Settings'); ?></h3>
<# if ( 'image' === data.type ) { #>
<label class="setting">
<span><?php _e('my Alignment'); ?></span>
<select class="myalignment"
data-setting="myalign"
<option value="left">
<?php esc_attr_e('Left'); ?>
</option>
<option value="center">
<?php esc_attr_e('Center'); ?>
</option>
<option value="right">
<?php esc_attr_e('Right'); ?>
</option>
<option value="none" selected>
<?php esc_attr_e('None'); ?>
</option>
</select>
</label>
<# } #>
</script>
<?php }
add_action( 'print_media_templates', 'add_my_media_view_template');
It will be loaded on the edit post screen (look in the source code) with all the other media templates. I don’t know however how to interact with it with Backbone. Not very useful, I know.
Maybe ask around on the wp-hackers mailing list: http://codex.ww.wp.xz.cn/Mailing_Lists#Hackers
Use attachment_fields_to_edit and attachment_fields_to_save. Still Works in 3.5.
Great tut here:
http://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/
There will be a lot of tutorials written all month on how to leverage all the cool new stuff in 3.5. Yes, attachment_fields_to_edit and attachment_fields_to_save continue to work as-is and are not deprecated.
I would very appreciate if there will be also some clue about how to hook custom (“Add Media” like) button with custom overlay content using JS Modal instead of ThickBox.