Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I ran into a problem with the media.module where certain menu items "Select Media", "Remove Media" are defined with paths as empty strings since they are only accessible through Javascript. At issue is the ctools_automodal_is_path_modal() function which evaluates them with this statement:
return (bool) preg_match($modal_paths_regex, $path);
The problem is that if there are no modal paths defined then $modal_paths_regex matches $path (since they are both empty) and a bunch of JS is added which causes trouble.