Back to Main Site

Building Custom Blocks and Templates for MTBuilder on RISE CRM

Last updated on Nov 22, 2026 7:37 AM 7:37 AM 2,051.50 ms

MTBuilder for PolyCMS on RISE CRM runs on a Virtual DOM state engine that separates visual drag-and-drop editing from lightweight production HTML output. Developers can extend the MTBuilder canvas from any PolyCMS sub-plugin using MTBuilder.registerBlock(), customize editor panels via JavaScript filters, embed native RISE CRM lead capture forms, and compile optimized production bundles through Webpack.

Core Architecture and Storage Lifecycle

When an editor saves a page in MTBuilder, two synchronized representations are persisted to your RISE CRM MySQL database (using your dynamic {db_prefix}, default rise_):

  1. Virtual DOM JSON Schema (mtbuilder_data): Stored in {db_prefix}blog_page_meta (rise_blog_page_meta). This JSON tree preserves nested sections, rows, columns, block settings, and CSS mappings so subsequent editing sessions reconstruct the exact workspace state.
  2. Compiled Production HTML (content): Generated by generateCleanHtml(), which strips editor overlays, drag handles, and admin controls before writing clean HTML directly into {db_prefix}blog_pages (rise_blog_pages). Public visitors receive static-speed HTML without loading the visual editor runtime.

Reusable full-page layouts and Template Parts are stored in {db_prefix}blog_mtbuilder_templates (alongside preset layout definitions in rise_blog_templates / rise_blog_mtbuilder_templates).

JavaScript Block Registration API

Register custom draggable blocks inside any PolyCMS sub-plugin using MTBuilder.registerBlock(blockType, config). Each block declares its sidebar group, icon, sidebar settings schema, and dual-mode render() method (Editor mock preview vs. Frontend output).

Example: Creating a RISE CRM Lead Capture Form Block

Create plugins/polycms/plugins/my-custom-plugin/assets/js/crm-lead-block.js:

MTBuilder.registerBlock('rise_crm_lead_form', {
    name: 'RISE CRM Lead Capture Form',
    icon: 'fa fa-user-plus',
    group: 'crm_integrations',
    acceptChildren: false,

    // Sidebar Inspector schema
    settingsSchema: [
        {
            key: 'formId',
            label: 'RISE Lead Form ID',
            type: 'select',
            options: {
                '1': 'Standard Newsletter & Inquiry Form',
                '2': 'Enterprise Demo Request Form'
            },
            default: '1'
        },
        {
            key: 'bgColor',
            label: 'Background Color',
            type: 'color',
            default: '#f8fafc'
        },
        {
            key: 'buttonText',
            label: 'Preview Button Label',
            type: 'text',
            default: 'Submit Request'
        }
    ],

    // Dual-mode render callback for Editor canvas and Public frontend
    render: function (node, renderChild, isFrontend) {
        const el = document.createElement('div');
        const formId = encodeURIComponent(node.settings.formId || '1');
        const bgColor = node.settings.bgColor || '#f8fafc';
        const btnText = node.settings.buttonText || 'Submit Request';

        el.className = 'mtb-rise-lead-wrap rounded shadow-sm p-4 w-100';
        el.style.backgroundColor = bgColor;

        if (isFrontend) {
            // Public frontend: embed the live RISE CRM Lead Capture Form
            el.innerHTML = `
                <div class="rise-crm-lead-form">