Appearance
Admin Bar
A toolbar on the site for signed-in users: the admin, New and Edit, as in WordPress.
kitloom/ · admins: kitloom/, kitloom/
Video lessons
Recorded in the Filament admin; the Nova admin works the same way.
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, Inspect — why this page is slow — once switched on, 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
| Part | Shown when |
|---|---|
| The bar | Admin Bar → Settings → Show the admin bar on the site is on (admin_, on until saved); the user is signed in and may enter the admin (Filament: can; Nova: the view gate); and their show_ user meta is not false — WordPress's "Show Toolbar when viewing site", for one user |
| New | One entry per public post type the user may create (its create_ capability) that the admin has a screen for; the first one is the link of New itself |
| Edit | The page is a post or a term the user may edit (edit_ / edit_) and the admin has a screen for it |
| Inspect | Admin Bar → Settings → Show Inspect in the bar is on (admin_, off until switched on) and the user holds manage_ |
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 (@site, 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-) and adds the admin- class to <body>. The page moves, but what a theme fixes or sticks to the top of the window does not: a sticky or fixed header, a phone's menu under it, a sidebar that sticks while the page scrolls. The bar sets WordPress's own variable -- (32px) on :, and a theme offsets such things by it — without the bar it is not set and the fallback applies:
css
.header {
position: sticky;
top: var(--wp-admin--admin-bar--height, 0px);
}Every bundled theme does; CSS taken from a WordPress theme that reads the variable works as it is.
A Vue theme moves from page to page without reloading: the bar then asks GET / (behind the session) what Edit leads to on the new page.
Inspect
Why is this page slow, and what does it do? Clicking Inspect asks GET / (behind the session, manage_, a throttle of its own: twenty a minute), which draws the page once more as the signed-in user through kitloom/site's Inspect\ — what php artisan kitloom: does — and answers the inspection as data, the same shape the site_ agent tool answers. The bar draws a panel under itself, in its own markup and styles: the template and its candidates, the statements (how many, in how long, exact duplicates and same-shape repeats first, then the slowest five), the page cache's verdict for a guest, the timing. The page is drawn a second time for it, with caches warm, and the panel says so. A Vue theme asks again on every page change while the panel is open.
Only a user who holds manage_ sees the entry or gets an answer, and only once the owner switched it on: the page is drawn once more per click, which nobody should be able to ask for by default. Guests never see it, and a cached page never carries it (the bar is not cached).
Configuration
The bar is switched on and off on Admin Bar → Settings in either admin (manage_), and Inspect with it (Show Inspect in the bar).
config/ (php artisan vendor:): register false leaves the bar out whatever the setting says; filament. and nova. turn off one admin's section and links.
For the application
An admin of its own tags a Kitloom\ with Admin: 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.