You are here

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

Get minimum number of registrants allowed per registration.

Return value

integer Minimum number of registrants allowed (>= 0)

Overrides EventMetaInterface::getRegistrantsMinimum

File

src/EventMeta.php, line 223

Class

EventMeta
Meta event wrapper for RNG.

Namespace

Drupal\rng

Code

public function getRegistrantsMinimum() {
  if (isset($this
    ->getEvent()->{EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MINIMUM})) {
    $field = $this
      ->getEvent()->{EventManagerInterface::FIELD_REGISTRATION_REGISTRANTS_MINIMUM};
    $minimum = $field->value;
    if ($minimum !== '' && is_numeric($minimum) && $minimum >= 0) {
      return $minimum;
    }
  }
  return 1;
}