Skip to content

Admin Bar ​

A toolbar on the site for signed-in users: the admin, New and Edit, as in WordPress.

kitloom/admin-bar · admins: kitloom/admin-bar-filament, kitloom/admin-bar-nova

A toolbar at the top of the site for signed-in users, as WordPress shows its own on the site: the site's title leading to the admin, New with every type the user may add, Edit for the post or term on screen, the user's name and Log Out. Where New and Edit lead is the admin's to say: kitloom/admin-bar-filament or kitloom/admin-bar-nova. Without either there is no bar.

Who sees what ​

PartShown when
The barAdmin Bar → Settings → Show the admin bar on the site is on (admin_bar_enabled, on until saved); the user is signed in and may enter the admin (Filament: canAccessPanel(); Nova: the viewNova gate); and their show_admin_bar_front user meta is not false — WordPress's "Show Toolbar when viewing site", for one user
NewOne entry per public post type the user may create (its create_posts capability) that the admin has a screen for; the first one is the link of New itself
EditThe page is a post or a term the user may edit (edit_post / edit_term) and the admin has a screen for it

Guests get nothing, and the page cache keeps only guests' pages, so a cached page never carries anyone's bar.

On the page ​

The bar goes right after <body> through the page scripts (@siteBodyOpen, which every theme has), with its own markup and styles: no theme needs to know about it. Like WordPress, it moves the page down (html { margin-top: 32px }) and adds the admin-bar class to <body>, so a theme with a fixed header can make room for it.

A Vue theme moves from page to page without reloading: the bar then asks GET /wp-json/admin-bar/v1/edit?path=/about/ (behind the session) what Edit leads to on the new page.

Configuration ​

The bar is switched on and off on Admin Bar → Settings in either admin (manage_options).

config/kitloom-admin-bar.php (php artisan vendor:publish --tag=kitloom-admin-bar-config): register false leaves the bar out whatever the setting says; filament.register and nova.register turn off one admin's section and links.

For the application ​

An admin of its own tags a Kitloom\AdminBar\Contracts\AdminLinks with AdminLinks::TAG: the admin's home for a user (or null when they may not enter), where a new post of a type is written, where a post or a term is edited. The bar takes the first admin that lets the user in; who may add or edit what it checks itself.

kitloom — modules and themes for Laravel.
Pricing · Services · License · Refunds · Privacy · Community · [email protected]