@jonssonworkwear/strapi-plugin-component-name v1.2.0
Component name custom field
This package provides a custom field for Strapi that holds the name of the component that is being used. It is set in the Content-Type Builder, hidden in the Content Manager, and only available to the API.
🏖️ Features
- Set component name: to make it avaialbe for the API.
- Hide it: to avoid confusion while content edition.
🔧 Installation
To install this plugin simply run this command in the Strapi project:
yarn add @jonssonworkwear/strapi-plugin-component-name✨ Usage
When adding a new field to a content type, select CUSTOM (instead of DEAFULT), then select Component name field.
Inside a content-type, we can use the following schema:
"icon": {
"type": "customField",
"customField": "plugin::component-name.ComponentNameField"
}🪛 Development
Clone this repository in the Strapi directory.
git clone https://github.com/JonssonWorkwear/strapi-plugin-component-name.git src/plugins/strapi-plugin-component-nameAdd the plugin to the yarn workspace, inside ./package.json file, so we won't need to use yarn inside plugin itself.
"workspaces": ["./src/plugins/strapi-plugin-component-name"]Install dependencies.
yarnRegister the plugin so Strapi can use it. Inside ./config/plugins.js file add an entry:
module.exports = ({ env }) => ({
"component-name": {
enabled: true,
resolve: "./src/plugins/strapi-plugin-component-name"
},
});Rebuild the project and start the server.
yarn build
yarn developOr perhaps use the --watch-admin flag to toggle hot reloading of the admin panel.
yarn develop --watch-adminRelease changes
All the changes are commited and pushed to this repository (or its forks), independently from the Strapi directory. The changes on the release branch will be published in the @jonssonworkwear/strapi-plugin-component-name package. If there is a new release published, plugins inside the Strapi project might need their version bumped.