diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 0f53b0a..f7fada8 100644
|
|
|
AttachmentCompat = View.extend({ |
| 2351 | 2351 | } |
| 2352 | 2352 | |
| 2353 | 2353 | _.each( this.$el.serializeArray(), function( pair ) { |
| 2354 | | data[ pair.name ] = pair.value; |
| | 2354 | /* |
| | 2355 | * Begin patch for dealing with multiple value input fields |
| | 2356 | */ |
| | 2357 | |
| | 2358 | // if the pair.name is greater than 2 chars and [] is the last two chars |
| | 2359 | if ( pair.name.length > 2 && '[]' == pair.name.substr( pair.name.length - 2 ) ) { |
| | 2360 | |
| | 2361 | // defined item as the name minus the [] |
| | 2362 | var item = pair.name.substr( 0, pair.name.length - 2 ); |
| | 2363 | //if item wasn't passed previously in data |
| | 2364 | if ( item in data ) { |
| | 2365 | // combine all of the pair.value together to one data[item] comma separated |
| | 2366 | var list = data[ item ] += ',' + pair.value; |
| | 2367 | |
| | 2368 | // split the list into a javascript object |
| | 2369 | data[ item ] = list.split(','); |
| | 2370 | |
| | 2371 | |
| | 2372 | /* if it is the first time sending for 'item' just add once |
| | 2373 | * storing even single records as an array only for inputs that have name="somename[]" |
| | 2374 | */ |
| | 2375 | } else { |
| | 2376 | var list = pair.value; |
| | 2377 | data[ item ] = list.split(','); |
| | 2378 | } // end if ( item in data ) |
| | 2379 | |
| | 2380 | //else if name does not end in [] |
| | 2381 | } else { |
| | 2382 | // send the value only |
| | 2383 | data[ pair.name ] = pair.value; |
| | 2384 | } |
| 2355 | 2385 | }); |
| 2356 | 2386 | |
| 2357 | 2387 | this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); |
diff --git src/wp-includes/js/media/views/attachment-compat.js src/wp-includes/js/media/views/attachment-compat.js
index a54c224..803c3fa 100644
|
|
|
AttachmentCompat = View.extend({ |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | _.each( this.$el.serializeArray(), function( pair ) { |
| 71 | | data[ pair.name ] = pair.value; |
| | 71 | /* |
| | 72 | * Begin patch for dealing with multiple value input fields |
| | 73 | */ |
| | 74 | |
| | 75 | // if the pair.name is greater than 2 chars and [] is the last two chars |
| | 76 | if ( pair.name.length > 2 && '[]' == pair.name.substr( pair.name.length - 2 ) ) { |
| | 77 | |
| | 78 | // defined item as the name minus the [] |
| | 79 | var item = pair.name.substr( 0, pair.name.length - 2 ); |
| | 80 | //if item wasn't passed previously in data |
| | 81 | if ( item in data ) { |
| | 82 | // combine all of the pair.value together to one data[item] comma separated |
| | 83 | var list = data[ item ] += ',' + pair.value; |
| | 84 | |
| | 85 | // split the list into a javascript object |
| | 86 | data[ item ] = list.split(','); |
| | 87 | |
| | 88 | |
| | 89 | /* if it is the first time sending for 'item' just add once |
| | 90 | * storing even single records as an array only for inputs that have name="somename[]" |
| | 91 | */ |
| | 92 | } else { |
| | 93 | var list = pair.value; |
| | 94 | data[ item ] = list.split(','); |
| | 95 | } // end if ( item in data ) |
| | 96 | |
| | 97 | //else if name does not end in [] |
| | 98 | } else { |
| | 99 | // send the value only |
| | 100 | data[ pair.name ] = pair.value; |
| | 101 | } |
| | 102 | |
| 72 | 103 | }); |
| 73 | 104 | |
| 74 | 105 | this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); |