gpb_admin_calendar_event
Description
Filter the admin calendar event response. Allows customizing data shown for bookings in the admin calendar.
Usage
Applied globally
add_filter( 'gpb_admin_calendar_event', 'my_custom_function' );Parameters
$event
array
Calendar event response data.
$booking
GP_BookingsBooking
Booking instance.
Examples
Change the event title to entry ID and customer name.
add_filter( 'gpb_admin_calendar_event', function ( $event, $booking ) {
if ( ! empty( $event['entryId'] ) && ! empty( $event['customerName'] ) ) {
$event['title'] = sprintf( 'Entry #%d - %s', (int) $event['entryId'], $event['customerName'] );
}
return $event;
}, 10, 2 );Change the event title to service/resource title and customer name.
add_filter( 'gpb_admin_calendar_event', function ( $event ) {
if ( ! empty( $event['customerName'] ) && ! empty( $event['title'] ) ) {
$event['title'] = sprintf( '%s - %s', $event['title'], $event['customerName'] );
}
return $event;
}, 10, 2 );