-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The existing `apermo-adminbar-sites` filter API must remain fully supported. When both filter and `.surf-links.yml` are present, merge them intelligently.
Priority (environments)
- PHP filter — always wins for environment URLs and settings
- `.surf-links.yml` environments — used if filter doesn't define the site
- Database settings — lowest priority fallback
Additive merge (tools + docs)
Even when the filter defines all environments, `.surf-links.yml` sections that the filter cannot express should still be added:
- `tools` → additional admin bar links (Jira, GitHub, Sentry, etc.)
- `docs` → additional admin bar links (Confluence, Figma, etc.)
- `name` → project display name (if not set via filter)
- `type` → CMS type for admin path auto-detection (if not already handled)
Existing filters preserved
All existing filters must continue to work:
| Filter | Purpose |
|---|---|
| `apermo-adminbar-sites` | Environment config |
| `apermo-adminbar-types` | Allowed environment types |
| `apermo-adminbar-colors` | Available color schemes |
| `apermo-adminbar-caps` | Required capability |
| `apermo-adminbar-watermark` | Toggle watermark |
| `apermo-adminbar-statusbox` | Toggle statusbox |
| `apermo-adminbar-keycodes` | Toggle keyboard shortcuts |
Example
```php
// functions.php — defines environments via filter
add_filter('apermo-adminbar-sites', function($sites) {
$sites['dev']['url'] = 'https://dev.example.com';
$sites['staging']['url'] = 'https://staging.example.com';
$sites['live']['url'] = 'https://example.com';
return $sites;
});
```
```yaml
.surf-links.yml — adds tools and docs on top
name: My Project
type: wordpress
tools:
jira:
url: https://myorg.atlassian.net/browse/{ticket}
pattern: "PROJ-\d+"
github: https://github.com/myorg/myproject
docs:
confluence: https://myorg.atlassian.net/wiki/spaces/PROJ
```
Result: environments from filter + tools/docs from YAML = full admin bar.
Depends on #21 (.surf-links.yml config reader).