So for v4, to update the controllers that are called when you CRUD in the Content Manager, you can now follow the flow described here:
- Create a file called
./src/extensions/content-manager/strapi-server.js. With following boiler plate:
module.exports = (plugin) => {
let original = plugin.controllers.["collection-types"].find;
plugin.controllers.["collection-types"].find = (ctx) => {
// Do your thing
// Call original function
original(ctx)
};
return plugin;
};
- To find what exists, you can check
node_modules/@strapi/plugin-content-manager/server/controllers; each file there corresponds to the key inplugin.controllers, and each function inside of the exports can be overwritten. (in the example I usedcollection-typesandfindrespectively).