Domain Mapping with WPML

Hi there, hope everyone is doing well

Like other people here, I had issues with the new domain mapping, and reverted to as it's a live site, with customers.

While reverting back, I also had to reupload the "old" sunrise.php in wp-content

I had added code to sunrise.php to make it work with WPML and now I see WPML has it included in the plugin's subfolders.

So I tried this with
I tried to add below those lines :

"dm_sunrise" => defined( "WP_PLUGIN_DIR" ) ?  rtrim( WP_PLUGIN_DIR, '/\\' ) . "/domain-mapping/inc/sunrise.php" : dirname( __FILE__ ) .  "/plugins/domain-mapping/inc/sunrise.php",
"md_sunrise" => defined( "WP_PLUGIN_DIR" ) ?  rtrim( WP_PLUGIN_DIR, '/\\' ) . "/multi-domains/inc/sunrise.php" : dirname( __FILE__ ) .  "/plugins/multi-domains/inc/sunrise.php"

adding a comma at the end of the last line, and add this :

"wpml_sunrise" => defined( "WP_PLUGIN_DIR" ) ?  rtrim( WP_PLUGIN_DIR, '/\\' ) . "/sitepress-multilingual-cms/inc/tools/sunrise.php" : dirname( __FILE__ ) .  "/sitepress-multilingual-cms/inc/tools/sunrise.php"

(inspired by your code above)

but it doesn't work, same issues !

so, in short, on the same install:
- domain mapping for sites WITHOUT WPML : everything is ok with
- domain mapping for sites WITH WPML : the menus, images, every url, take the instead of the mapped domain.

Ideally, I would like to see a conditional code into sunrise.php to test if WPML is there, then add the WPML sunrise :

Thank you in advance to help me (us) make it work with the latest version.