OK, I think I have found the problem and a solution.
The problem is that the script that Bricks uses to insert images is enqueued from a completely different file from the other scripts. I have no idea why. (I have also noted that the JavaScript scripts it supplies are all minified, which is a breach of the GPL license. All code should be supplied in a human-readable form, even if the active files are minified.)
So here’s the solution. It’s in two parts.
- Go back and put the code I provided back into the very first file you had it in, i.e
setup.php. That will make it work for the scripts loaded from that file. - Now find the file
bricks/includes/builder.phpand look for these lines:
if ( bricks_is_builder_main() ) {
// Manually enqueue dashicons for 'wp_enqueue_media' as 'get_wp_editor' prevents dashicons enqueue
wp_enqueue_style( 'bricks-dashicons', includes_url( '/css/dashicons.min.css' ), [], null );
Right under that add the same code as before, i.e.
/**
* Scripts
*/
global $wp_scripts;
$deps = $wp_scripts->registered['media-views']->deps;
foreach ( $deps as $key => $dep ) {
if ( $dep === 'sortable-js' ) {
unset( $deps[$key] );
$deps[$key] = 'jquery-ui-sortable';
ksort( $deps );
$wp_scripts->registered['media-views']->deps = $deps;
break;
}
}
Save the file, and it should work now. You might find a few buttons misaligned on the image insert screen, but they shouldn’t get in the way.