Nova allows you to render content at various points in the framework's views. It's useful for add-ons to be able to inject HTML into the framework.
Using render hooks
To use a render hook, you can call NovaView::registerRenderHook() from a service provider or middleware. The first argument is the name of the render hook and the second argument is a callback that returns the content to be rendered:
use NovaView;use Illuminate\Support\Facades\Blade; NovaView::registerRenderHook( 'admin::content.end', fn () => Blade::render('@livewire(\'livewire-ui-modal\')'));
You could also render view content from a file:
use NovaView;use Illuminate\Contracts\View\View; NovaView::registerRenderHook( 'admin::content.end', fn () => view('impersonation-banner'));
Available render hooks
admin::body.start- After the opening<body>tag of the admin systemadmin::body.end- Before the closing</body>tag of the admin systemadmin::content.start- Before the admin page content, inside<main>admin::content.end- After the admin page content, inside<main>admin::footer.start- Before the admin page footer, inside<footer>admin::footer.end- After the admin page footer, inside<footer>admin::scripts.before- Before the admin scripts are called at the end of the<body>tagadmin::scripts.after- After the admin scripts are called at the end of the<body>tagadmin::head-scripts.before- Before the admin scripts are called in the<head>tagadmin::head-scripts.after- After the admin scripts are called in the<head>tagadmin::styles.before- Before the admin styles are called in the<head>tagadmin::styles.after- After the admin styles are called in the<head>tagauth::login.form.before- Before the login formauth::login.form.after- After the login formpublic::body.start- After the opening<body>tag of the public pagespublic::body.end- Before the closing</body>tag of the public pagespublic::content.start- Before public page content, inside<main>public::content.end- After public page content, inside<main>public::footer.start- Before the public page footer, inside<footer>public::footer.end- After the public page footer, inside<footer>
Rendering hooks
Extension developers might find it useful to expose render hooks to their users. You do not need to register them anywhere, simply output them in Blade like so:
{{ NovaView::renderHook('render.hook.name') }}