kreatif / statamic-cp-toolbar
Shows logged-in Statamic CP users a small front-end toolbar with a direct link to edit the current entry in the Control Panel - in every environment, not just local.
Package info
github.com/kreatifIT/statamic-cp-toolbar
Type:statamic-addon
pkg:composer/kreatif/statamic-cp-toolbar
Requires
- php: ^8.1
- statamic/cms: ^5.0
Requires (Dev)
- orchestra/testbench: ^9.0 || ^10.0
README
Shows logged-in Statamic Control Panel users a small, unobtrusive front-end toolbar with a direct link to edit the current entry in the CP.
Unlike toolbars bundled into starter kits (which are typically hard-restricted to APP_ENV=local), this addon works in every environment - local, staging, and production - because it's gated on who's logged in, not on where the app is running. It has no dependency on any starter kit or theme: no Tailwind, no Alpine.js, just plain inline CSS/JS.
Installation
composer require kreatif/statamic-cp-toolbar
Then add the toolbar to your layout, once, wherever your other global partials live (before </body> is a good spot):
{{ partial:kreatif-cp-toolbar::components/toolbar }}
That's it. It renders nothing for anonymous visitors and nothing on pages that aren't backed by an editable entry - it only appears for an authenticated user on a page that exposes Statamic's own edit_url.
Configuration
Publish the config if you want to change the defaults:
php artisan vendor:publish --tag=kreatif-cp-toolbar-config
return [ // Kill switch - false hides the toolbar everywhere, for everyone. 'enabled' => env('CP_TOOLBAR_ENABLED', true), // Which auth guard counts as "logged in". Defaults to Statamic's own CP // guard. If your app also has a separate front-end member/subscriber // login on its own guard, leave this pointed at the CP guard so // subscribers never see an internal "edit in CP" link. 'guard' => env('CP_TOOLBAR_GUARD', 'web'), // bottom-right, bottom-left, top-right or top-left. 'position' => env('CP_TOOLBAR_POSITION', 'bottom-right'), ];
You can also override the view itself:
php artisan vendor:publish --tag=kreatif-cp-toolbar-views
which publishes to resources/views/vendor/kreatif-cp-toolbar/components/toolbar.antlers.html.
Why not just use environment == 'local'?
An "edit in CP" shortcut is genuinely useful to editors reviewing content on staging or production, not just to developers on their laptop. Gating it by environment defeats its own purpose the moment content review happens anywhere but local. Gating it by login is both more useful (works everywhere an editor is actually working) and safer (never shown to anonymous visitors, regardless of environment).
Requirements
- PHP ^8.1
- Statamic ^5.0
License
MIT