UNPKG

payload-all-in-one-accessibility

Version:

Website accessibility widget for improving WCAG 2.0, 2.1, 2.2 and ADA compliance!

66 lines (65 loc) 2.4 kB
export const payloadAllInOneAccessibility = (pluginOptions)=>(config)=>{ if (!config.collections) { config.collections = []; } /** * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations. * If your plugin heavily modifies the database schema, you may want to remove this property. */ if (pluginOptions.disabled) { return config; } if (!config.endpoints) { config.endpoints = []; } if (!config.admin) { config.admin = {}; } if (!config.admin.components) { config.admin.components = { actions: [ 'payload-all-in-one-accessibility/client#BeforeDashboardClient' ] }; } // if (!config.admin.components.beforeDashboard) { // config.admin.components.beforeDashboard = [] // } // config.admin.components.beforeDashboard.push( // `payload-all-in-one-accessibility/client#BeforeDashboardClient`, // ) // config.admin.components.beforeDashboard.push( // `payload-all-in-one-accessibility/rsc#BeforeDashboardServer`, // ) // config.endpoints.push({ // handler: () => { // return Response.json({ message: 'Hello from custom endpoint' }) // }, // method: 'get', // path: '/my-plugin-endpoint', // }) // const incomingOnInit = config.onInit // config.onInit = async (payload) => { // // Ensure we are executing any existing onInit functions before running our own. // if (incomingOnInit) { // await incomingOnInit(payload) // } // const { totalDocs } = await payload.count({ // collection: 'plugin-collection', // where: { // id: { // equals: 'seeded-by-plugin', // }, // }, // }) // if (totalDocs === 0) { // await payload.create({ // collection: 'plugin-collection', // data: { // id: 'seeded-by-plugin', // }, // }) // } // } return config; }; //# sourceMappingURL=index.js.map