@inspirer-dev/hero-widget-cta-button
Version:
A custom field plugin for Strapi v5 that provides a CTA button selector with different action types (external link, internal link, case, article, copy link, copy nickname).
57 lines (51 loc) • 1.38 kB
text/typescript
import { Link } from '@strapi/icons';
import { PLUGIN_ID } from './pluginId';
import { Initializer } from './components/Initializer';
export default {
register(app: any) {
// Register custom field for CTA button
app.customFields.register({
name: 'cta-button',
pluginId: PLUGIN_ID,
plugin: PLUGIN_ID,
type: 'json',
intlLabel: {
id: `${PLUGIN_ID}.cta-button.label`,
defaultMessage: 'CTA Button',
},
intlDescription: {
id: `${PLUGIN_ID}.cta-button.description`,
defaultMessage: 'Configure a CTA button with different action types',
},
icon: Link,
components: {
Input: async () => import('./components/CTAButtonInput'),
},
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 };
}
})
);
},
};