@websolutespa/payload-plugin-thron
v0.0.5
Published
Thron data plugin for PayloadCms
Downloads
329
Readme
@websolutespa/payload-plugin-thron
Thron media import plugin for PayloadCms.
Payload Thron media import Plugin
A plugin that allows you to import media assets from Thron repository.
Requirements:
- Payload version 2.28.0 or higher is required.
Installation
npm i @websolutespa/payload-plugin-thronUsage
Plugin Configuration
import { buildConfig } from 'payload/config';
import thron from '@websolutespa/payload-plugin-thron';
export default buildConfig({
plugins: [
// ...
thron({
clientId: process.env.THRON_CLIENT_ID,
appId: process.env.THRON_APP_ID,
appKey: process.env.THRON_APP_KEY,
publicKey: process.env.THRON_PUBLIC_KEY,
}),
],
});Single Asset Selection
Use withThron() to add a Thron asset selector field:
import { withThron } from '@websolutespa/payload-plugin-thron';
{
type: 'group',
name: 'hero',
fields: [
withThron({
name: 'backgroundImage',
contentTypes: ['IMAGE'],
}),
],
}Multiple Asset Selection
Use withThronMultiple() to add a Thron multiple asset selector field.
import { withThronMultiple } from '@websolutespa/payload-plugin-thron';
{
...withThronMultiple({
targetArrayField: 'items', // the name of the array field containing the thron field
targetThronField: 'image', // optional: the name of the thron field (default is "thron")
contentTypes: ['IMAGE'], // optional (default is ['IMAGE', 'VIDEO'])
}),
{
type: 'array',
name: 'items',
fields: [
withThron({
name: 'image',
contentTypes: ['IMAGE'],
}),
],
},
}