Legacy Page Builder Addon Migration
If an addon pack worked on an older MultiSaas version but now:
- does not appear in the page-builder panel, or
- throws
Class "Plugins\PageBuilder\PageBuilderBase" not found, or - appears to install (module enabled, views present) but does nothing,
it was built for the legacy page-builder API. The current editor uses a different widget contract.
What changed
| Legacy addon API | Current widget API |
|---|---|
Plugins\PageBuilder\PageBuilderBase | Xgenious\PageBuilder\Core\BaseWidget |
module.json → pageBuilderAddon | WidgetRegistry::register() or config('xgpagebuilder.widget_paths') |
admin_render() returns form HTML | getGeneralFields() / getStyleFields() return field definitions |
frontend_render() + $this->value() | render(array $settings) |
preview_image() / setAssetsFilePath() | Not used; thumbnails are rendered from field defaults |
core/Modules/<Name> (nwidart module) | core/plugins/<Name> with plugin.json and a provider |
The old base class is not present in the current application, and the old manifest key is not consumed by the editor. Enabling a legacy module only boots its views/config provider; it does not register the addons.
Diagnose an installed pack
Run these from core/:
# 1) Legacy base class references (should be none in a current installation)
grep -rn "PageBuilderBase" app plugins Modules
# 2) The old manifest helpers still exist, but nothing consumes them
grep -rn "getPageBuilderAddonList" app | head
# 3) Current registration path
grep -rn "WidgetRegistry::register" plugins | head
# 4) Current preview endpoints
php artisan route:list | grep -E "preview-bulk|/preview|/thumbnail"
# 5) Package version
composer show xgenious/xgpagebuilder | grep versions
The editor loads widgets from WidgetRegistry; a pack that only declares pageBuilderAddon in module.json is invisible to it.
Migrate an addon
1. Replace the base class
namespace Plugins\MyAddons\PageBuilder\Widgets;
use Xgenious\PageBuilder\Core\BaseWidget;
use Xgenious\PageBuilder\Core\ControlManager;
use Xgenious\PageBuilder\Core\FieldManager;
use Xgenious\PageBuilder\Core\WidgetCategory;
class HeroWidget extends BaseWidget
{
protected function getWidgetType(): string
{
return 'my_hero'; // unique, stable, lowercase
}
protected function getWidgetName(): string
{
return __('My – Hero');
}
protected function getWidgetIcon(): string
{
return 'las la-image';
}
protected function getWidgetDescription(): string
{
return __('Hero with heading, text, image and two buttons.');
}
protected function getCategory(): string
{
return WidgetCategory::THEME;
}
public function getGeneralFields(): array
{
$control = new ControlManager();
$control->addGroup('content', __('Content'))
->registerField('eyebrow', FieldManager::TEXT()
->setLabel(__('Small title'))
->setDefault('DESIGN & BUILD'))
->registerField('title', FieldManager::TEXT()
->setLabel(__('Title'))
->setDefault('Design and build, perfectly delivered'))
->registerField('text', FieldManager::TEXTAREA()
->setLabel(__('Text'))
->setDefault('A short description.'))
->registerField('image', FieldManager::IMAGE()
->setLabel(__('Image')))
->endGroup();
$control->addGroup('buttons', __('Buttons'))
->registerField('btn1_text', FieldManager::TEXT()
->setLabel(__('Primary button text'))
->setDefault('Get started'))
->registerField('btn1_url', FieldManager::URL()
->setLabel(__('Primary button URL'))
->setDefault('#'))
->registerField('btn2_text', FieldManager::TEXT()
->setLabel(__('Secondary button text'))
->setDefault('Learn more'))
->registerField('btn2_url', FieldManager::URL()
->setLabel(__('Secondary button URL'))
->setDefault('#'))
->endGroup();
return $control->getFields();
}
public function getStyleFields(): array
{
return [];
}
public function render(array $settings = []): string
{
$content = $settings['general']['content'] ?? [];
$buttons = $settings['general']['buttons'] ?? [];
$image = $content['image'] ?? '';
if (is_array($image)) {
$image = $image['url'] ?? '';
}
return view('myaddons::hero', [
'eyebrow' => (string) ($content['eyebrow'] ?? ''),
'title' => (string) ($content['title'] ?? ''),
'text' => (string) ($content['text'] ?? ''),
'image' => (string) $image,
'primaryText' => (string) ($buttons['btn1_text'] ?? ''),
'primaryUrl' => (string) ($buttons['btn1_url'] ?? ''),
'secondaryText' => (string) ($buttons['btn2_text'] ?? ''),
'secondaryUrl' => (string) ($buttons['btn2_url'] ?? ''),
])->render();
}
public function enable(): bool
{
return ! is_null(tenant()); // tenant-only
}
}
2. Register the widgets
Prefer a plugin under core/plugins/MyAddons:
{
"id": "MyAddons",
"name": "My Addons",
"version": "2.0.0",
"author": "Your Company",
"provider": "Plugins\\MyAddons\\Providers\\MyAddonsServiceProvider",
"scope": "tenant",
"description": "Page builder sections for My themes."
}
namespace Plugins\MyAddons\Providers;
use Illuminate\Support\ServiceProvider;
use Xgenious\PageBuilder\Core\WidgetRegistry;
class MyAddonsServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->loadViewsFrom(plugin_module_path('MyAddons', 'Resources/views'), 'myaddons');
if (class_exists(WidgetRegistry::class)) {
foreach ([
\Plugins\MyAddons\PageBuilder\Widgets\HeroWidget::class,
// ... all widgets
] as $widget) {
WidgetRegistry::register($widget);
}
}
}
}
Then add "MyAddons": true to core/modules_statuses.json, run composer dump-autoload, and clear caches.
Alternative: put the classes in a folder and add a widget_paths entry in core/config/xgpagebuilder.php.
3. Map the old fields
| Legacy helper | Current API |
|---|---|
Text::get([...]) | FieldManager::TEXT()->setLabel(...)->setDefault(...) |
Textarea::get([...]) | FieldManager::TEXTAREA() |
Summernote::get([...]) | FieldManager::WYSIWYG() |
Image::get([...]) | FieldManager::IMAGE() — value is an object; read $value['url'] |
ImageGallery::get([...]) | FieldManager::REPEATER() of image fields |
Select::get([...]) | FieldManager::SELECT()->setOptions([...]) |
Switcher::get([...]) | FieldManager::TOGGLE() |
ColorPicker::get([...]) | FieldManager::COLOR() |
IconPicker::get([...]) | FieldManager::ICON_INPUT() |
Repeater::get([...]) | FieldManager::REPEATER()->setFields([...])->setDefault([...]) |
Add realistic defaults to every visible field and repeater. The editor uses them for the initial render, the sidebar thumbnail and the add-widget state.
4. Map the render + settings
admin_render()→getGeneralFields()andgetStyleFields().frontend_render()→render(array $settings).$this->value('x', $default)→$settings['general'][<group>]['x'] ?? $default.$this->setting_item('image')→$settings['general'][<group>]['image'].self::renderView('view', $data, 'Module')→view('myaddons::view', $data)->render().preview_image()/setAssetsFilePath()are not used. The thumbnail endpoint renders the widget with defaults.
5. Keep visibility rules
The legacy manifest marked widgets with landlord / tenant flags. In the current API:
public function enable(): bool
{
return ! is_null(tenant()); // tenant-only
// return is_null(tenant()); // landlord-only
// return true; // both
}
You can also exclude a plugin widget namespace per panel in core/config/xgpagebuilder.php (context_excluded_widget_namespaces).
6. Update the theme demo layout
A legacy theme's assets/page-layout/home-layout.json is an array of old addons (addon_name, addon_namespace, addon_page_type, legacy Plugins\PageBuilder\Addons\... namespaces). The current editor does not use that format for new widgets.
Either:
- rebuild the demo pages in the current editor and ship the current page-builder content, or
- remove the legacy demo layout and document that pages are built manually with the new widgets.
The theme shell itself (theme.json, header/footer hooks, assets) can stay in the current format.
Installation checklist
- No
PageBuilderBasereferences remain. - Every widget extends
BaseWidgetwith a uniquegetWidgetType(). - Widgets are registered via
WidgetRegistry(orwidget_paths). -
plugin.jsonis present (or the module provider registers the widgets), and the plugin is enabled. -
composer dump-autoloadandphp artisan optimize:clearwere run. - Widgets appear in the panel, drop/render instantly from the thumbnail, save and reload.
- Frontend rendering matches the theme CSS; image fields resolve to URLs.
- Tenant/landlord visibility is correct.
- The theme installs, the checker passes, and its demo layout is current or removed.
- Tested on staging with
xgenious/xgpagebuilderv1.10.0 or newer.
The old install instructions (upload to core/Modules, add pageBuilderAddon to module.json) are for the legacy editor. They do not register widgets in the current one. Update the pack's install guide with the plugin/WidgetRegistry steps above.
See Page Builder Addon Development for the full field API, and Plugin Development for manifests, providers and menus.

