Skip to content
  1. Extras
  2. PageBuilder
  3. Editor and manager
  4. Manager and events

Manager and events

Control panel

PageBuilder control panel

Manager component: Components → PageBuilder (namespace pagebuilder, controller index).

In the control panel:

  • list of resources with sections
  • jump to section editor
  • Section types (permission pagebuilder_manage_types): UI types, hide and restore built-in JSON types
  • Basket (Pro, flag basket): global basket for deleted sections and table rows
  • Collections tab settings when pagebuilder_collections_* are enabled

The editor on the resource form and in the control panel uses one Vue bundle via VueTools. Manager API entry:

assets/components/pagebuilder/connector.php

Data model

Main page record: table pb_pages (prefix modx_pb_).

FieldPurpose
resource_idLink to modResource
draft_jsonSection document draft
published_jsonPublished version
revisionDraft revision number (optimistic locking)
published_revisionLast publish revision
publishedon / publishedbyPublish time and user
editedon / editedbyLast draft change

PageBuilder does not overwrite modResource.content. Resource SEO fields (pagetitle, description) are used as usual.

Page basket stores deleted sections in document.trash. On draft save a plugin syncs index pb_basket_items. There is no separate pbOn* event for basket: a plugin on pbOnAfterSave can read record.draft.trash. Global restore and permanent delete use Pro connector actions (mgr/basket/*).

Resource table data lives in separate pb_* tables (Tables tab).

PageBuilder Pro

The pagebuilderpro extra adds shared blocks, section journal, catalog examples, breakpoint fields, 20 advanced field types, global basket in the control panel, and Agent API.

Details: PageBuilder Pro. Storefront sections require miniShop3.

Events

On install the extra registers 20 pbOn* events in MODX. Subscribe a plugin under System → Events or use the static plugin from the package.

Exception: pbOnBeforeTableGetList and pbOnTableRowSave are not created by the installer. Add events manually if your plugin should react.

Registration on boot

EventData
pbOnRegisterSectionDefinitionsregistry: SectionRegistry, add custom types
pbOnRegisterFeatureProvidersregistry: FeatureProviderRegistry

Page lifecycle

EventWhen
pbOnBeforeSave / pbOnAfterSaveDraft (mode=draft)
pbOnBeforePublish / pbOnAfterPublishPublish
pbOnBeforeUnpublish / pbOnAfterUnpublishUnpublish
pbOnBeforeTrash / pbOnAfterTrashMove sections to basket

In pbOnBeforeSave extensions can replace the document via PageDocumentBag. In pbOnAfterSave and similar, field changes contains DocumentChangeSet (ids of sections added, removed, trashed, restored, enabled, and disabled).

Copy

EventData
pbOnBeforeCopySectionssourceResourceId, targetResourceId, userId
pbOnAfterCopySections+ record

Catalog and fields

EventPurpose
pbOnBeforeGetList / pbOnAfterGetListCatalog list (mgr/catalog/list)
pbOnFieldValuesFieldValuesBag: field value substitution (mgr/field/options, picker)
pbOnCheckSectionRequirementrequirement, result.satisfied: check depends (pro, minishop3)
pbOnCheckSectionVisibilityPro: settings.conditions, result.visible, section visibility on frontend

Resource table data

Manual registration

Events below are not registered on install. Add them under System → Events if your plugin should react.

EventWhen
pbOnBeforeTableGetListFilter rows (criteria passed by reference)
pbOnTableRowSaveBefore row save (data passed by reference)

Frontend render

EventData
pbOnBeforeRenderDocumentresourceId, document, pipeline, options
pbOnBeforeRenderSectionindex, pipeline: mutate section before chunk
pbOnGetValuesWhen snippet has return_values=1

Example section registration in a plugin:

php
<?php
switch ($modx->event->name) {
    case 'pbOnRegisterSectionDefinitions':
        /** @var \PageBuilder\Section\SectionRegistry $registry */
        $registry = $modx->event->params['registry'];
        $registry->registerFromFile($modx->getOption('core_path') . 'components/mypackage/sections/custom.json');
        break;
}

Custom JSON definitions must match built-in section schema: fields, chunk, category.

Save, publish, and frontend output

The editor writes the draft via connector, publish copies snapshot to published_json, the site snippet reads only the published version.