Skip to main content

Open your own panel beside every Benecaster screen with a shortcut

Free Advanced

For a tool the podcaster reaches for mid-task — a back-catalogue search, show notes, a checklist — without leaving the screen they are on. PHP declares the panel through benecaster_admin_shell_panels; JavaScript draws it in the slot BenecasterShellPanel_{id}. Your add-on ships compiled JavaScript for this, as in Inject a React component into a named slot.

Benecaster owns whether the panel is open or closed, so you never keep that state yourself. Choose scope deliberately: leave it out for anything about the selected show, and the panel runs only on shows where your add-on is active; set any_show for a tool for the podcaster themself, and it runs on every show. Give people a button as well as the shortcut, because a shortcut is invisible:

const { registerFill, openShellPanel } = window.BenecasterExtensions;

registerFill( 'BenecasterShellPanel_my-lookup', ( { showId, activeShowIds, close } ) => {
    // any_show: the fill runs on every show. Search only the shows the add-on is active on.
    return <LookupForm shows={ activeShowIds } onPick={ close } />;
} );

// Somewhere visible (your add-on screen, a Dashboard card) — a way in for people who don't know the shortcut.
registerFill( 'BenecasterDashboardCards', () => (
    <button type="button" onClick={ () => openShellPanel( 'my-lookup' ) }>Open Lookup (Alt+Shift+L)</button>
) );

Code

<?php
add_filter( 'benecaster_admin_shell_panels', static function ( array $panels ): array {
    $panels[] = [
        'id'       => 'my-lookup',
        'label'    => __( 'Lookup', 'my-addon' ),
        'add_on'   => 'my-addon',
        'scope'    => 'any_show',      // A tool for the podcaster themself. Leave it out for anything about the selected show.
        'shortcut' => 'alt+shift+l',  // mod = Cmd on a Mac, Ctrl elsewhere. Copy, paste, find, bold… are refused.
    ];
    return $panels;
} );

// The panel is drawn in JavaScript:
// window.BenecasterExtensions.registerFill( 'BenecasterShellPanel_my-lookup', MyLookup );

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →