From 2ea818a4dafae380a821dc17bc39444a70ddd163 Mon Sep 17 00:00:00 2001 From: Pierre Wizla <4233866+pwizla@users.noreply.github.com> Date: Wed, 11 Mar 2026 16:45:29 +0100 Subject: [PATCH] Fix plugins extension page --- .../plugins-development/plugins-extension.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docusaurus/docs/cms/plugins-development/plugins-extension.md b/docusaurus/docs/cms/plugins-development/plugins-extension.md index c8d7ed5aea..6f446bbcf3 100644 --- a/docusaurus/docs/cms/plugins-development/plugins-extension.md +++ b/docusaurus/docs/cms/plugins-development/plugins-extension.md @@ -37,9 +37,9 @@ Plugin extensions code is located in the `./src/extensions` folder (see [project strapi-server.js|ts /content-types /some-content-type-to-extend - model.json + schema.json /another-content-type-to-extend - model.json + schema.json /another-plugin-to-extend strapi-server.js|ts ``` @@ -58,7 +58,7 @@ The final schema of the content-types depends on the following loading order: 1. the content-types of the original plugin, 2. the content-types overridden by the declarations in the [schema](/cms/backend-customization/models#model-schema) defined in `./src/extensions/plugin-name/content-types/content-type-name/schema.json` -3. the content-types declarations in the [`content-types` key exported from `strapi-server.js|ts`](/cms/plugins-development/server-content-types) +3. the content-types declarations in the [`contentTypes` export from `strapi-server.js|ts`](/cms/plugins-development/server-content-types) 4. the content-types declarations in the [`register()` function](/cms/configurations/functions#register) of the Strapi application To overwrite a plugin's [content-types](/cms/backend-customization/models): @@ -123,9 +123,9 @@ The `strapi-server.js|ts` file is also where you can override the image function ```js title="./src/extensions/upload/strapi-server.js|ts" module.exports = (plugin) => { - plugin.services.upload.image.generateFileName = (file) => { - // Example: prefix a timestamp before the original name - return `${Date.now()}_${file.hash}${file.ext}`; + plugin.services['image-manipulation'].generateFileName = (file) => { + // Example: prefix a timestamp before the generated base name + return `${Date.now()}_${name}`; }; return plugin; @@ -136,6 +136,12 @@ module.exports = (plugin) => { ::: +`generateFileName()` belongs to the Upload plugin's `image-manipulation` service and expects a single `name: string` argument. + +:::caution +This customization relies on an internal Upload plugin service (`image-manipulation`). Internal extension points are not part of Strapi's stable public API and can change between versions. +::: + ### Within the register and bootstrap functions To extend a plugin's interface within `./src/index.js|ts`, use the `bootstrap()` and `register()` [functions](/cms/configurations/functions) of the whole project, and access the interface programmatically with [getters](/cms/plugins-development/server-getters-usage).