Listen for "Save" with useCMEditViewDataManager

Hi, i am building a plugin where i inject a content manager component. Now, i want to listen to the “save” button, so when a user saves the entity, it fires a function in my component that saves the current data. Is that possible with the useCMEditViewDataManager hook?

I know about the content type lifecycle hooks (Models | Strapi Documentation), but (i think) you cant use them for a plugin, since you need to declare them in the /api folder.

Does anyone know what the best practice for this scenario is? I want to avoid adding a second “save” button in my component and have the user to press two buttons to save the entity.

This topic has been created from a Discord post (1245828934810075198) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

That’s not correct

You can declare them in a plugin

Using this method you can inject lifecycle in any content type

From plugin

You can check this for example

I think i overlooked this. Thank you.