diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 0f53b0a..5196fea 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 | |
| 2366 | // combine all of the pair.value together to one data[item] comma separated |
| 2367 | var list = data[ item ] += ',' + pair.value; |
| 2368 | |
| 2369 | // split the list into a javascript object |
| 2370 | data[ item ] = list.split(','); |
| 2371 | |
| 2372 | |
| 2373 | /* if it is the first time sending for 'item' just add once |
| 2374 | * storing even single records as an array only for inputs |
| 2375 | * that have name="somename[]" |
| 2376 | */ |
| 2377 | } else { |
| 2378 | var list = pair.value; |
| 2379 | data[ item ] = list.split(','); |
| 2380 | } // end if ( item in data ) |
| 2381 | |
| 2382 | //else if name does not end in [] |
| 2383 | } else { |
| 2384 | // send the value only |
| 2385 | data[ pair.name ] = pair.value; |
| 2386 | } |
2355 | 2387 | }); |
2356 | 2388 | |
2357 | 2389 | 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..8dd48f4 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 | |
| 83 | // combine all of the pair.value together to one data[item] comma separated |
| 84 | var list = data[ item ] += ',' + pair.value; |
| 85 | |
| 86 | // split the list into a javascript object |
| 87 | data[ item ] = list.split(','); |
| 88 | |
| 89 | |
| 90 | /* if it is the first time sending for 'item' just add once |
| 91 | * storing even single records as an array only for inputs |
| 92 | * that have name="somename[]" |
| 93 | */ |
| 94 | } else { |
| 95 | var list = pair.value; |
| 96 | data[ item ] = list.split(','); |
| 97 | } // end if ( item in data ) |
| 98 | |
| 99 | //else if name does not end in [] |
| 100 | } else { |
| 101 | // send the value only |
| 102 | data[ pair.name ] = pair.value; |
| 103 | } |
72 | 104 | }); |
73 | 105 | |
74 | 106 | this.controller.trigger( 'attachment:compat:waiting', ['waiting'] ); |