Neuron-PHP

EventRegistrationWidget
in package
implements IWidget

Event registration widget / shortcode.

Renders a registration form for one or more calendar events. Two modes:

[event-registration event="my-event-slug"] -> register for one event [event-registration category="workshops"] -> pick from the next upcoming events of a type

In category mode the next upcoming events (default 3) are offered as a selectable list so a single form powers an entire event type. The form posts to /events/register. A CSRF token is fetched client-side from /events/register/token so the markup stays valid even when the page is cached.

Private events require a logged-in member: in single-event mode anonymous visitors see a login prompt; in category mode private events are hidden from anonymous visitors. The submit handler re-checks visibility authoritatively.

Table of Contents

Interfaces

IWidget
Widget interface for extensible shortcode/widget system.

Constants

DEFAULT_LIMIT  : mixed = 3

Properties

$_categoryRepository  : IEventCategoryRepository
$_eventRepository  : IEventRepository
$_registrationRepository  : IEventRegistrationRepository|null
$_sessionManager  : SessionManager|null

Methods

__construct()  : mixed
getAttributes()  : array<string, string>
Supported shortcode attributes.
getDescription()  : string
Widget description (for documentation).
getName()  : string
Shortcode name.
render()  : string
Render the registration form.
consumeFlash()  : array{0: ?string, 1: ?string}
Read and clear registration flash messages set by the controller.
esc()  : string
HTML-escape helper.
fullPrompt()  : string
Message shown when an event has reached capacity.
isFull()  : bool
Whether an event has reached its registration capacity.
isLoggedIn()  : bool
Whether a member is currently logged in (checks the session directly so it works on public pages where the auth filter has not run).
loginPrompt()  : string
Prompt shown to anonymous visitors for a private (members-only) event.
renderCategory()  : string
Render a registration form offering the next upcoming events of a category.
renderForm()  : string
Render the shared form shell around the event-selection markup.
renderSingle()  : string
Render a registration form for a single event.
session()  : SessionManager|null
Lazily resolve a started session manager.
tokenScript()  : string
Inline script (rendered once per page) that fetches a fresh CSRF token and injects it into every registration form, keeping cached markup valid.

Constants

Properties

Methods

getAttributes()

Supported shortcode attributes.

public getAttributes() : array<string, string>
Return values
array<string, string>

getDescription()

Widget description (for documentation).

public getDescription() : string
Return values
string

Widget description

getName()

Shortcode name.

public getName() : string
Return values
string

Shortcode name (e.g., 'property-listings')

render()

Render the registration form.

public render(array<string, mixed> $attrs) : string
Parameters
$attrs : array<string, mixed>

Shortcode attributes

Return values
string

Rendered HTML

consumeFlash()

Read and clear registration flash messages set by the controller.

private consumeFlash() : array{0: ?string, 1: ?string}
Return values
array{0: ?string, 1: ?string}

[success, error]

esc()

HTML-escape helper.

private esc(string $value) : string
Parameters
$value : string
Return values
string

fullPrompt()

Message shown when an event has reached capacity.

private fullPrompt() : string
Return values
string

isFull()

Whether an event has reached its registration capacity.

private isFull(Event $event) : bool

Returns false when no registration repository is available (the submit controller still enforces capacity authoritatively).

Parameters
$event : Event
Return values
bool

isLoggedIn()

Whether a member is currently logged in (checks the session directly so it works on public pages where the auth filter has not run).

private isLoggedIn() : bool
Return values
bool

loginPrompt()

Prompt shown to anonymous visitors for a private (members-only) event.

private loginPrompt() : string
Return values
string

renderCategory()

Render a registration form offering the next upcoming events of a category.

private renderCategory(string $slug, array<string, mixed> $attrs, bool $loggedIn) : string
Parameters
$slug : string
$attrs : array<string, mixed>
$loggedIn : bool
Return values
string

renderForm()

Render the shared form shell around the event-selection markup.

private renderForm(string $title, string $button, string $eventSelection) : string
Parameters
$title : string
$button : string
$eventSelection : string

Event id input/select markup

Return values
string

renderSingle()

Render a registration form for a single event.

private renderSingle(string $slug, array<string, mixed> $attrs, bool $loggedIn) : string
Parameters
$slug : string
$attrs : array<string, mixed>
$loggedIn : bool
Return values
string

tokenScript()

Inline script (rendered once per page) that fetches a fresh CSRF token and injects it into every registration form, keeping cached markup valid.

private tokenScript() : string
Return values
string
On this page

Search results