WidgetRenderer
in package
Renders built-in widgets.
This class provides implementations for common CMS widgets. Custom widgets should be implemented as Widget classes and registered with the WidgetRegistry.
Table of Contents
Properties
- $_eventCategoryRepository : IEventCategoryRepository|null
- $_eventRegistrationRepository : IEventRegistrationRepository|null
- $_eventRepository : IEventRepository|null
- $_postRepository : IPostRepository|null
- $_settings : SettingManager|null
Methods
- __construct() : mixed
- render() : string
- Render a widget by type
- renderCalendar() : string
- Render calendar widget
- renderContact() : string
- Render contact form widget
- renderEventRegistration() : string
- Render event registration widget
- renderFeaturedEvent() : string
- Render featured event widget
- renderLatestPosts() : string
- Render latest posts widget
- renderUnknownWidget() : string
- Render unknown widget placeholder
Properties
$_eventCategoryRepository
private
IEventCategoryRepository|null
$_eventCategoryRepository
= null
$_eventRegistrationRepository
private
IEventRegistrationRepository|null
$_eventRegistrationRepository
= null
$_eventRepository
private
IEventRepository|null
$_eventRepository
= null
$_postRepository
private
IPostRepository|null
$_postRepository
= null
$_settings
private
SettingManager|null
$_settings
= null
Methods
__construct()
public
__construct([IPostRepository|null $postRepository = null ][, IEventRepository|null $eventRepository = null ][, IEventCategoryRepository|null $eventCategoryRepository = null ][, SettingManager|null $settings = null ][, IEventRegistrationRepository|null $eventRegistrationRepository = null ]) : mixed
Parameters
- $postRepository : IPostRepository|null = null
- $eventRepository : IEventRepository|null = null
- $eventCategoryRepository : IEventCategoryRepository|null = null
- $settings : SettingManager|null = null
- $eventRegistrationRepository : IEventRegistrationRepository|null = null
render()
Render a widget by type
public
render(string $widgetType, array<string, mixed> $config) : string
Parameters
- $widgetType : string
-
Widget type name
- $config : array<string, mixed>
-
Widget configuration/attributes
Return values
string —Rendered HTML
renderCalendar()
Render calendar widget
private
renderCalendar(array<string, mixed> $config) : string
Attributes:
- category: Filter by category slug (optional)
- limit: Number of events to show (default: 5)
- upcoming: Show upcoming events (true) or past events (false) (default: true)
Parameters
- $config : array<string, mixed>
Return values
stringrenderContact()
Render contact form widget
private
renderContact(array<string, mixed> $config) : string
Attributes:
- form: Contact form key from config (default: configured default_form)
- title: Optional heading override
- button: Optional submit button label override
Parameters
- $config : array<string, mixed>
Return values
stringrenderEventRegistration()
Render event registration widget
private
renderEventRegistration(array<string, mixed> $config) : string
Attributes:
- event: Event slug for single-event registration
- category: Event category slug to offer the next upcoming events of that type
- limit: Number of upcoming dates to offer in category mode (default: 3)
- title: Optional heading override
- button: Optional submit button label override
Parameters
- $config : array<string, mixed>
Return values
stringrenderFeaturedEvent()
Render featured event widget
private
renderFeaturedEvent(array<string, mixed> $config) : string
Renders the next available featured event. Takes no attributes.
Parameters
- $config : array<string, mixed>
Return values
stringrenderLatestPosts()
Render latest posts widget
private
renderLatestPosts(array<string, mixed> $config) : string
Attributes:
- category: Filter by category slug (optional)
- limit: Number of posts to show (default: 5)
Parameters
- $config : array<string, mixed>
Return values
stringrenderUnknownWidget()
Render unknown widget placeholder
private
renderUnknownWidget(string $widgetType) : string
Parameters
- $widgetType : string