UNPKG

@inspirer-dev/hero-size-checkbox

Version:

A custom field plugin for Strapi v5 that provides a checkbox selector for hero widget sizes (XL, L, M, S).

59 lines (53 loc) 1.45 kB
import { Check } from "@strapi/icons"; import { PLUGIN_ID } from "./pluginId"; import { Initializer } from "./components/Initializer"; export default { register(app: any) { // Register custom field for hero size checkbox app.customFields.register({ name: "hero-size-checkbox", pluginId: PLUGIN_ID, plugin: PLUGIN_ID, type: "json", intlLabel: { id: `${PLUGIN_ID}.hero-size-checkbox.label`, defaultMessage: "Hero Size Checkbox", }, intlDescription: { id: `${PLUGIN_ID}.hero-size-checkbox.description`, defaultMessage: "Select multiple hero widget sizes (XL, L, M, S)", }, icon: Check, components: { Input: async () => import("./components/HeroSizeCheckboxInput"), }, options: { base: [], advanced: [], }, }); app.registerPlugin({ id: PLUGIN_ID, initializer: Initializer, isReady: false, name: PLUGIN_ID, }); }, bootstrap(app: any) { // Simplified bootstrap - no injection zones for now }, async registerTrads({ locales }: { locales: string[] }) { return Promise.all( locales.map(async (locale) => { try { const { default: data } = await import( `./translations/${locale}.json` ); return { data, locale }; } catch { return { data: {}, locale }; } }) ); }, };