You should not need any code.
If your field type is compatible, it should work without any coding.
Depends on the theme though, but I doubt any theme will have collapsible row incompatible with RTE mf. Given the name “collapsible row” I’d guess it may be Dawn family theme, but need to be sure.
Can you share a screenshot of your configuration?
Here is mine:
