Initial commit of WooNooW Docs
This commit is contained in:
50
contents/docs/developer/addons/module-integration/index.mdx
Normal file
50
contents/docs/developer/addons/module-integration/index.mdx
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title: Module Integration
|
||||
description: Integrating Addons usage with Module Registry
|
||||
date: 2024-01-31
|
||||
---
|
||||
|
||||
# Addon-Module Integration
|
||||
|
||||
## Vision
|
||||
|
||||
**Module Registry as the Single Source of Truth.**
|
||||
Functionality extensions—whether built-in Modules or external Addons—should live in the same UI.
|
||||
|
||||
## Registration
|
||||
|
||||
Addons register themselves via the `woonoow/addon_registry` filter.
|
||||
|
||||
```php
|
||||
add_filter('woonoow/addon_registry', function($addons) {
|
||||
$addons['my-shipping-addon'] = [
|
||||
'id' => 'my-shipping-addon',
|
||||
'name' => 'My Shipping',
|
||||
'description' => 'Custom shipping integration',
|
||||
'version' => '1.0.0',
|
||||
'author' => 'My Company',
|
||||
'category' => 'shipping',
|
||||
'icon' => 'truck',
|
||||
'settings_url' => '/settings/shipping/my-addon',
|
||||
'spa_bundle' => plugin_dir_url(__FILE__) . 'dist/addon.js',
|
||||
];
|
||||
return $addons;
|
||||
});
|
||||
```
|
||||
|
||||
This ensures your addon appears in the **WooNooW Modules** list with a consistent UI, toggle switch, and settings link.
|
||||
|
||||
## Settings Pages
|
||||
|
||||
Addons can register their own SPA routes for settings pages.
|
||||
|
||||
```php
|
||||
add_filter('woonoow/spa_routes', function($routes) {
|
||||
$routes[] = [
|
||||
'path' => '/settings/shipping/my-addon',
|
||||
'component_url' => plugin_dir_url(__FILE__) . 'dist/Settings.js',
|
||||
'title' => 'My Addon Settings',
|
||||
];
|
||||
return $routes;
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user