Provide emptySeats count variable to event display
When showing an event I wanted to be able to show how many seats were left - in a custom template.
I was able to add a TPL variable emptySeats in CRM_Event_Page_EventInfo CRM/Event/Page/EventInfo.php after line 276 as follows:
$eventEmptySeats = CRM_Event_BAO_Participant::eventFull($this->_id,
TRUE,
$hasWaitingList
);
$this->assign('emptySeats', $eventEmptySeats);
The call to eventFull() has $returnEmptySeats set to TRUE. This returns an integer greater than zero or the event full text or FALSE if no max participant count set.
This variable can be referenced in {$emptySeats}.
I have tested this in 5.4.0 under WordPress. I have not run any other tests.
I have a fork/branch ready to submit as a PR if this would be useful. I could not immediately find a place where to document this additional variable.