Page Builder Widgets
Themes can ship their own page builder widgets inside a Widgets/ directory. They are auto-discovered on boot — no registration in core files required.
File convention
- File:
themes/mytheme/Widgets/HeroSection.php - Namespace:
Themes\Mytheme\Widgets\HeroSection - View:
view('theme-mytheme::widgets.hero_section')
Minimal widget
themes/mytheme/Widgets/HeroSection.php
<?php
namespace Themes\Mytheme\Widgets;
use Xgenious\PageBuilder\Base\BaseWidget;
class HeroSection extends BaseWidget
{
public function name(): string { return 'Hero Section'; }
public function category(): string { return 'My Theme'; }
public function icon(): string { return 'mdi mdi-image-area'; }
public function keywords(): array { return ['hero', 'banner']; }
public function preview(): string { return 'A full-width hero banner with CTA.'; }
/**
* Return false to hide this widget from tenants not using this theme.
* Without this method, the widget shows for all tenants.
*/
public function enable(): bool
{
return !is_null(tenant()) && tenant()->theme_slug === 'mytheme';
}
public function render(): string
{
return view('theme-mytheme::widgets.hero_section', [
'title' => $this->data('title', 'Welcome'),
'subtitle' => $this->data('subtitle', ''),
'cta_text' => $this->data('cta_text', 'Shop Now'),
'cta_url' => $this->data('cta_url', theme_shop_url()),
])->render();
}
public function form(): array
{
return [
'title' => ['type' => 'text', 'label' => 'Heading'],
'subtitle' => ['type' => 'text', 'label' => 'Sub-heading'],
'cta_text' => ['type' => 'text', 'label' => 'Button Text'],
'cta_url' => ['type' => 'text', 'label' => 'Button URL'],
];
}
}
The enable() Method
Without enable(), a widget appears for all tenants in the page builder panel. Add enable() to scope it to your theme only:
public function enable(): bool
{
// Only show this widget when the tenant is using 'mytheme'
return !is_null(tenant()) && tenant()->theme_slug === 'mytheme';
}
Warning
⚠️ ⚠ Landlord widgets Widgets in the \landlord\ namespace are automatically shown only in the landlord admin and hidden from tenant page builder panels — no enable() needed.
Still stuck?
Our support team is ready to help you get set up.

