Problem/Motivation
We are interacting with the Host Entity in our code and need to determine things like the reason the registration is closed.
Our original plan was to interrogate the $errors returned from the isEnabledForRegistration - but there were some inconsistencies when using set and forget mode (e.g once the registration is disabled, we can't specifically test it is because the date has passed).
In the end it would be helpful to us if we were able to use the same logic the host entity class is using in other places by exposing the current logic in as additional public methods.
Proposed resolution
Add 3 new public methods to the HostEntity interface - getSpacesRemaining, isBeforeOpen and isAfterClose
Comments
Comment #2
ericgsmith commentedComment #3
john.oltman commentedMakes total sense, thanks @eric I will test and commit soon.
Comment #5
john.oltman commentedWorked great, committed. I changed it slightly to account for capacity of zero (unlimited) - you may need to change your block to handle a null return from the spaces remaining function. Also, if you are pulling commits into your local copy of the module, there was a commit before this one that requires a drush updb (will mention in next release notes - should be out this weekend).