QR Code
Display generated QR Codes on the admin panel's ContentTypes
A plugin for Strapi Headless CMS that provides an easy way to show QR Codes in Strapi entities.
Features
- Show QR Code to strapi entities on update form. This QR Code leads to computed text.
Usage
To configure the QR Code plugin, add your configuration to the plugin settings. The configuration consist of an array of contentTypes with their own computeValue function:
1type Config = {
2 contentTypes: Array<{
3 uid: UID.ContentType
4 populate?: Array<string> | '*'
5 computeValue: (
6 uid: UID.ContentType,
7 status: 'draft' | 'published',
8 document: Modules.Documents.Document<UID.ContentType>
9 ): string | Promise<string>;
10 }>,
11};
This configuration allows you to define a computeValue for content-types associated. The plugin try to fetch the concerned entity and pass it to computeValue function in document parameters. The string output of the function is what is used to generate the QR Code.
Example Configuration
1// config/plugins.ts
2import type { Config as QRCodeConfig } from 'strapi-plugin-qr-code/dist/server/src/config'
3
4export default () => ({
5 'qr-code': {
6 enabled: true,
7 config: {
8 contentTypes: [
9 {
10 uid: 'api::content.content',
11 computeValue: (uid, status, document) => {
12 return `/${uid.split('.')[1]}?status=${status}&documentId=${document.documentId}`
13 },
14 },
15 {
16 uid: 'api::category.category',
17 computeValue: (uid, status, document) => {
18 return `My category is: ${document.name} - status: ${status} - edited: ${document.updatedDate}`
19 },
20 },
21 ],
22 } satisfies QRCodeConfig,
23 }
24})
Install now
npm install strapi-plugin-qr-code
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.