-
Notifications
You must be signed in to change notification settings - Fork 0
Plugins
Marble supports installable plugins. Plugins are standard Laravel packages that hook into the admin panel via the MarbleAdmin facade — no core files need to be modified.
composer require vendor/package-name
php artisan vendor:publish --tag=plugin-assets # if the plugin has assetsLaravel auto-discovery registers the plugin's ServiceProvider automatically (requires extra.laravel.providers in the plugin's composer.json).
The System → Plugins page searches Packagist for packages with "type": "marble-plugin" and enriches results with the marblecms/plugins registry, which marks packages as verified and featured.
{
"name": "vendor/my-marble-plugin",
"type": "marble-plugin",
"require": {
"marble/admin": "^1.0"
},
"extra": {
"laravel": {
"providers": [
"Vendor\\MyPlugin\\MyPluginServiceProvider"
]
}
}
}The "type": "marble-plugin" makes the package discoverable in the Marble admin plugin search.
All plugin integration happens from the boot() method of your ServiceProvider:
use Marble\Admin\Facades\MarbleAdmin;
class MyPluginServiceProvider extends ServiceProvider
{
public function boot(): void
{
// Add an item to an existing admin dropdown
MarbleAdmin::addNavItem('content', 'My Section', 'myplugin.index', 'plugin', ['myplugin.*']);
// Add a new top-level nav dropdown
MarbleAdmin::addTopNavSection('myplugin', [
'label' => 'My Plugin',
'icon' => 'plugin',
'patterns' => ['myplugin.*'],
'items' => [
['label' => 'Overview', 'route' => 'myplugin.index', 'icon' => 'chart_bar'],
['label' => 'Settings', 'route' => 'myplugin.config', 'icon' => 'wrench'],
],
]);
// Inject CSS/JS into every admin page
MarbleAdmin::addAsset('css', asset('vendor/myplugin/plugin.css'));
MarbleAdmin::addAsset('js', asset('vendor/myplugin/plugin.js'));
// Register a CKEditor 4 external plugin
MarbleAdmin::addCkEditorPlugin(
'myplugin',
asset('vendor/myplugin/ckeditor/'),
['MyButton'],
'marble'
);
}
}use Marble\Admin\Facades\MarbleAdmin;Adds an item to one of the core admin nav dropdowns.
| Parameter | Description |
|---|---|
$section |
'content', 'structure', 'users', or 'system'
|
$label |
Display text |
$route |
Named Laravel route |
$icon |
Famicon name (without .svg) |
$activePatterns |
Route name patterns that highlight this section. Defaults to ['{route}*']
|
MarbleAdmin::addNavItem('content', 'Orders', 'marble.shop.orders', 'cart', ['marble.shop.*']);Registers a new top-level nav dropdown rendered after the System menu.
MarbleAdmin::addTopNavSection('shop', [
'label' => 'Shop',
'icon' => 'cart',
'patterns' => ['marble.shop.*'],
'items' => [
['label' => 'Overview', 'route' => 'marble.shop.index', 'icon' => 'chart_bar'],
['label' => 'Orders', 'route' => 'marble.shop.orders', 'icon' => 'cart'],
],
]);Injects a CSS or JS file into every admin page.
| Parameter | Values |
|---|---|
$type |
'css' or 'js'
|
$url |
Fully-qualified public URL (asset() helper recommended) |
CSS is injected after the admin theme stylesheet. JS is injected after the core scripts.
Registers a CKEditor 4 external plugin.
| Parameter | Description |
|---|---|
$name |
Matches the name passed to CKEDITOR.plugins.add()
|
$url |
URL to the directory containing plugin.js (must end with /) |
$buttons |
Button names to add to the toolbar |
$group |
Toolbar group to append buttons to (default: 'marble') |
MarbleAdmin::addCkEditorPlugin(
'marbleai',
asset('vendor/marble-ai/ckeditor/'),
['MarbleAiButton'],
'marble'
);| Plugin | Description |
|---|---|
| marblecms/marble-ecommerce | Products, orders, discount codes, Stripe Checkout |
Browse all verified plugins in System → Plugins inside the admin panel.