File tree Expand file tree Collapse file tree 2 files changed +29
-9
lines changed
MediaGalleryUi/view/adminhtml/web/js/image Expand file tree Collapse file tree 2 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -162,9 +162,9 @@ define([
162
162
*/
163
163
getFilterUrl : function ( link ) {
164
164
return link + '?filters[asset_id]=[' + this . image ( ) . id + ']' +
165
- '&value=' + this . image ( ) . id +
166
- '& label=' + this . image ( ) . title +
167
- '& src=' + this . image ( ) [ 'image_url' ] ;
165
+ '&options[]=[ value=' + this . image ( ) . id +
166
+ ', label=' + this . image ( ) . title +
167
+ ', src=' + this . image ( ) [ 'image_url' ] + ']' ;
168
168
} ,
169
169
170
170
/**
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ define([
54
54
55
55
if ( Object . keys ( options ) . length ) {
56
56
this . selectComponent ( ) . options ( options ) ;
57
- this . selectComponent ( ) . cacheOptions . plain = [ options ] ;
57
+ this . selectComponent ( ) . cacheOptions . plain = options ;
58
58
}
59
59
60
60
if ( Object . keys ( urlFilter ) . length ) {
@@ -99,12 +99,32 @@ define([
99
99
* @param {String } url
100
100
*/
101
101
getOptionsParam : function ( url ) {
102
- var searchString = decodeURI ( url ) ,
103
- options ;
104
- options = Object . fromEntries ( new URLSearchParams ( searchString ) ) ;
105
- delete options [ 'filters[asset_id]' ] ;
102
+ var params = [ ] ,
103
+ chunks ,
104
+ chunk ,
105
+ values = { } ,
106
+ options ,
107
+ searchString = decodeURI ( url ) ;
108
+
109
+ _ . chain ( searchString . slice ( 1 ) . split ( '&' ) )
110
+ . map ( function ( item , k ) {
111
+ if ( item && item . search ( this . optionsKey ) !== - 1 ) {
112
+ chunks = item . substring ( item . indexOf ( '?' ) + 1 ) . split ( '&' ) ;
113
+
114
+ for ( var i = 0 ; i < chunks . length ; i ++ ) {
115
+ options = chunks [ i ] . substring ( item . indexOf ( '[]' ) + 3 ) . replace ( / [ \[ \] ] / g, '' ) . split ( ',' ) ;
116
+ options . map ( function ( item ) {
117
+ chunk = item . split ( '=' ) ;
118
+ values [ chunk [ 0 ] ] = chunk [ 1 ] ;
119
+ } . bind ( this ) ) ;
120
+ }
121
+ params [ k - 1 ] = values ;
122
+ values = { } ;
123
+ }
124
+ } . bind ( this ) ) ;
106
125
107
- return options ;
126
+ return params ;
108
127
}
128
+
109
129
} ) ;
110
130
} ) ;
You can’t perform that action at this time.
0 commit comments