You are here

public function EventMeta::getRegistrantsMaximum in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/EventMeta.php \Drupal\rng\EventMeta::getRegistrantsMaximum()
  2. 3.x src/EventMeta.php \Drupal\rng\EventMeta::getRegistrantsMaximum()

Get maximum number of registrants allowed per registration.

Return value

integer|EventMetaInterface::CAPACITY_UNLIMITED Maximum number of registrants allowed (>= 0), or unlimited.

Overrides EventMetaInterface::getRegistrantsMaximum

File

src/EventMeta.php, line 237

Class

EventMeta
Meta event wrapper for RNG.

Namespace

Drupal\rng

Code

public function getRegistrantsMaximum() {
  if (isset($this
    ->getEvent()->{EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MAXIMUM})) {
    $field = $this
      ->getEvent()->{EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MAXIMUM};
    $maximum = $field->value;
    if ($maximum !== '' && is_numeric($maximum) && $maximum >= 0) {
      return $maximum;
    }
  }
  return EventMetaInterface::CAPACITY_UNLIMITED;
}