\WP_Stager_Integration\Calendar::component_year(int $year, array $all_events = null, array $args = array()): void
\WP_Stager_Integration\Calendar::component_year(int $year, array $all_events = null, array $args = array()): voidDescription
Renders a full year view of events.
Ensures that all 12 months exist in the hierarchy, even if they contain no events.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$year | int | The year to render (e.g. 2025). |
$all_events | array | Nested hierarchy of events (year ā month ā day). |
$args | array | (Optional) Additional arguments to pass to the component template. |
Returns:
void
Information
| File | class-calendar.php line 1767 |
|---|
Full Code
/**
* Renders a full year view of events.
*
* Ensures that all 12 months exist in the hierarchy,
* even if they contain no events.
*
* @param int $year The year to render (e.g. 2025).
* @param array $all_events Nested hierarchy of events (year ā month ā day).
* @param array $args (Optional) Additional arguments to pass to the component template.
*
* @return void
*/
public static function component_year( $year, $all_events = null, $args = array() ) {
// Type casting
$year = (int) $year;
$all_events = (array) $all_events;
$args = (array) $args;
// Fill missing months
self::fill_missing_months( $all_events, $year );
self::render_calendar_component( 'year', array(
'year' => $year,
'events' => $all_events,
'component_args' => $args,
) );
}š” If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration
š Limited offer: Use code WELCOME26 to get your first month for free!

