File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
build/media_source/system/js/fields Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -113,18 +113,24 @@ const setupField = (container) => {
113113 const action = button . dataset . buttonAction ;
114114 const dialogConfig = button . dataset . modalConfig ? JSON . parse ( button . dataset . modalConfig ) : { } ;
115115 const keyName = container . dataset . keyName || 'id' ;
116+ const token = Joomla . getOptions ( 'csrf.token' , '' ) ;
116117
117118 // Handle requested action
118119 let handle ;
119120 switch ( action ) {
120121 case 'select' :
121- case 'create' :
122+ case 'create' : {
123+ const url = dialogConfig . src . indexOf ( 'http' ) === 0 ? new URL ( dialogConfig . src ) : new URL ( dialogConfig . src , window . location . origin ) ;
124+ url . searchParams . set ( token , '1' ) ;
125+ dialogConfig . src = url . toString ( ) ;
122126 handle = doSelect ( inputValue , inputTitle , dialogConfig ) ;
123127 break ;
128+ }
124129 case 'edit' : {
125130 // Update current value in the URL
126131 const url = dialogConfig . src . indexOf ( 'http' ) === 0 ? new URL ( dialogConfig . src ) : new URL ( dialogConfig . src , window . location . origin ) ;
127132 url . searchParams . set ( keyName , inputValue . value ) ;
133+ url . searchParams . set ( token , '1' ) ;
128134 dialogConfig . src = url . toString ( ) ;
129135
130136 handle = doSelect ( inputValue , inputTitle , dialogConfig ) ;
You can’t perform that action at this time.
0 commit comments