Inject a component in a specific collection type

Hello,

I am creating a plugin and in the bootstrap() function, I use the injectContentManagerComponent() function to inject in the Edit view a component.

What I am currently trying to achieve is to show the injected component only on a specific collection type and not in all available collection types.

How would you do that if you were in my shoes?

Any ideas are welcome!
Thanks in advance.

2 Likes

same problem!

You can make use of the slug property of the useCMEditViewDataManager react hook. The slug property will hold the collection-type on which the injected component is getting displayed.

For Example:
If you want to display the injected component only in users collection-types, add a condition to the return of your injected component like (slug === api::user.user).