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

ericgsmith created an issue. See original summary.

ericgsmith’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new4.7 KB
john.oltman’s picture

Makes total sense, thanks @eric I will test and commit soon.

john.oltman’s picture

Status: Needs review » Fixed

Worked 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).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.