Ticket #22938: 22938.patch
File 22938.patch, 2.9 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
2300 2300 wp_update_post( $post ); 2301 2301 2302 2302 foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) { 2303 if ( isset( $attachment_data[ $taxonomy ] ) ) 2304 wp_set_object_terms( $id, array_map( 'trim', preg_split( '/,+/', $attachment_data[ $taxonomy ] ) ), $taxonomy, false ); 2303 if ( isset( $attachment_data[ $taxonomy ] ) ) { 2304 if ( !is_array( $attachment_data[ $taxonomy ] ) ) $attachment_data[ $taxonomy ] = array($attachment_data[ $taxonomy ]); 2305 wp_set_object_terms( $id, array_map( 'intval', $attachment_data[ $taxonomy ] ), $taxonomy, false ); 2306 } 2305 2307 } 2306 2308 2307 2309 if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) -
src/wp-admin/includes/media.php
1570 1570 if ( empty($t['args']) ) 1571 1571 $t['args'] = array(); 1572 1572 1573 $terms = get_object_term_cache($post->ID, $taxonomy); 1574 if ( false === $terms ) 1575 $terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']); 1573 $t['taxonomy'] = true; 1576 1574 1577 $values = array(); 1575 $inputname = $taxonomy . 'checklist'; 1576 $t['input'] = $inputname; 1578 1577 1579 foreach ( $terms as $term ) 1580 $values[] = $term->slug; 1581 $t['value'] = join(', ', $values); 1582 $t['taxonomy'] = true; 1578 $thtml = '<div class="categorydiv"><ul>'; 1579 ob_start(); 1580 wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'checked_ontop' => false ) ); 1581 $thtml .= ob_get_contents(); 1582 ob_end_clean(); 1583 1583 1584 // right now wp_terms_checklist can only return input elements 1585 // with post_category[] as the name 1586 // 1587 // TODO: rewrite Walker_Category_Checklist to be more modular 1588 // so the input names can be changed 1589 $thtml = str_replace('post_category[]', 'attachments[' . $post->ID . '][' . $taxonomy . ']', $thtml); 1590 $thtml .= '</ul></div>'; 1591 1592 $t[$inputname] = $thtml; 1593 1584 1594 $form_fields[$taxonomy] = $t; 1585 1595 } 1586 1596 } -
src/wp-includes/js/media-views.js
6908 6908 } 6909 6909 6910 6910 _.each( this.$el.serializeArray(), function( pair ) { 6911 data[ pair.name ] = pair.value; 6911 if (data[ pair.name ]) { 6912 // this case handles checkbox inputs where multiple can 6913 // be selected (like categories on an attachment) 6914 if (!_.isArray(data[ pair.name ])) data[ pair.name ] = [data[ pair.name ]]; 6915 data[ pair.name ].push(pair.value); 6916 } else { 6917 data[ pair.name ] = pair.value; 6918 } 6912 6919 }); 6913 6920 6914 6921 this.controller.trigger( 'attachment:compat:waiting', ['waiting'] );