--- name: contentbox-cfml-admin-extension description: "Use this skill when extending the ContentBox admin UI with custom menus, views, interception points, editor integrations, workflows, and secure admin-only module behaviors." applyTo: "**/*.{cfc,cfm,cfml}" --- # ContentBox Admin Extension (CFML) Extend the ContentBox admin interface using CFML. Add custom panels, modify existing screens, inject HTML into admin layouts, hook into content lifecycle events, and register new admin functionality. ## Admin Module Overview The admin module lives at `modules/contentbox/modules/contentbox-admin/` with entry point `cbadmin`. It provides: - **30+ handlers** for managing content, authors, settings, security, etc. - **Admin layouts** with consistent navigation and UI - **Interceptors** for request processing, 2FA enforcement, menu management - **Interception points** for extending every part of the admin UI ## Admin Extension Points ### 1. Layout HTML Injection Inject custom HTML into the admin layout at specific points: | Interception Point | Location | |-------------------|----------| | `cbadmin_beforeHeadEnd` | Before `` tag | | `cbadmin_afterBodyStart` | After `` tag | | `cbadmin_beforeBodyEnd` | Before `` tag | | `cbadmin_footer` | Admin footer area | | `cbadmin_beforeContent` | Before main content area | | `cbadmin_afterContent` | After main content area | | `cbadmin_onTagLine` | Tag line area | | `cbadmin_onTopBar` | Top navigation bar | #### Example: Inject Custom CSS/JS ```cfml ' )> ' )> ``` ### 2. Content Editor Extension Extend the content editor (entry/page editing screens): | Interception Point | Location | |-------------------|----------| | `cbadmin_contentEditorSidebar` | Sidebar area | | `cbadmin_contentEditorSidebarAccordion` | Sidebar accordion sections | | `cbadmin_contentEditorSidebarFooter` | Bottom of sidebar | | `cbadmin_contentEditorFooter` | Editor footer | | `cbadmin_contentEditorInBody` | Inside editor body | | `cbadmin_contentEditorNav` | Editor navigation | | `cbadmin_contentEditorNavContent` | Editor nav content | #### Example: Add Custom Sidebar Panel ```cfml

My Custom Panel

Custom panel content here

``` ### 3. Content Lifecycle Events Hook into content save, remove, and status change events: #### Entry Events | Point | When | |-------|------| | `cbadmin_preEntrySave` | Before entry is saved | | `cbadmin_postEntrySave` | After entry is saved | | `cbadmin_preEntryRemove` | Before entry is deleted | | `cbadmin_postEntryRemove` | After entry is deleted | | `cbadmin_onEntryStatusUpdate` | When entry status changes | #### Page Events | Point | When | |-------|------| | `cbadmin_prePageSave` | Before page is saved | | `cbadmin_postPageSave` | After page is saved | | `cbadmin_prePageRemove` | Before page is deleted | | `cbadmin_postPageRemove` | After page is deleted | | `cbadmin_onPageStatusUpdate` | When page status changes | #### Example: Post-Save Hook ```cfml ``` ### 4. Author Extension Extend author management screens: | Point | Location | |-------|----------| | `cbadmin_UserPreferencePanel` | User preferences panel | | `cbadmin_onAuthorEditorNav` | Author editor navigation | | `cbadmin_onAuthorEditorContent` | Author editor content area | | `cbadmin_onAuthorEditorSidebar` | Author editor sidebar | | `cbadmin_onAuthorEditorActions` | Author editor action buttons | | `cbadmin_onNewAuthorForm` | New author form | | `cbadmin_onNewAuthorActions` | New author form actions | | `cbadmin_preNewAuthorSave` | Before new author saved | | `cbadmin_postNewAuthorSave` | After new author saved | | `cbadmin_onAuthorPasswordChange` | When author password changes | | `cbadmin_preAuthorPreferencesSave` | Before preferences saved | | `cbadmin_postAuthorPreferencesSave` | After preferences saved | #### Example: Add Custom Author Field ```cfml
``` ### 5. Dashboard Extension Add content to the admin dashboard: | Point | Location | |-------|----------| | `cbadmin_onDashboard` | Dashboard main area | | `cbadmin_preDashboardContent` | Before dashboard content | | `cbadmin_postDashboardContent` | After dashboard content | | `cbadmin_preDashboardSideBar` | Before dashboard sidebar | | `cbadmin_postDashboardSideBar` | After dashboard sidebar | | `cbadmin_onDashboardTabNav` | Dashboard tab navigation | | `cbadmin_preDashboardTabContent` | Before tab content | | `cbadmin_postDashboardTabContent` | After tab content | ### 6. Admin Menu Registration Register custom menu items via `cbadmin_onAdminMenuLoad`: ```cfml ``` ## Registering Admin Interceptors Register your interceptors in your module's `ModuleConfig.cfc`: ```cfml ``` ## Creating Custom Admin Handlers Extend `baseHandler` for admin handlers: ```cfml ``` ## Admin Routes Define routes in your module's `ModuleConfig.cfc`: ```cfml ``` ## Admin Security Admin handlers inherit security from the admin firewall. Configure permissions: ```cfml ``` ## Best Practices 1. **Use interception points** — don't modify core admin files 2. **Register interceptors** in your module's `ModuleConfig.cfc` 3. **Extend `baseHandler`** for admin handlers 4. **Use `prc` scope** for passing data to admin views 5. **Check permissions** before rendering admin content 6. **Use `buffer.append()`** for HTML injection interceptors 7. **Follow admin UI patterns** — match existing styling and structure 8. **Test with all engines** — Lucee, Adobe CF, BoxLang 9. **Use `provider:` injection** to avoid circular dependencies 10. **Document custom interception points** in your module ## Engine Compatibility This skill targets **CFML engines** (Lucee 5+, Adobe ColdFusion 2018+). For BoxLang-specific syntax and features, see the BoxLang variant of this skill.