You are here

public function EventMeta::removeRegistrationType in RNG - Events and Registrations 3.x

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

Removes references to an allowed registration type from the event.

Parameters

string $registration_type_id: The ID of a registration_type entity.

Return value

\Drupal\Core\Entity\EntityInterface The modified event.

Overrides EventMetaInterface::removeRegistrationType

File

src/EventMeta.php, line 208

Class

EventMeta
Meta event wrapper for RNG.

Namespace

Drupal\rng

Code

public function removeRegistrationType($registration_type_id) {

  /** @var \Drupal\Core\Field\FieldItemListInterface $registration_types */
  $registration_types =& $this->entity->{EventManagerInterface::FIELD_REGISTRATION_TYPE};
  foreach ($registration_types
    ->getValue() as $key => $value) {
    if ($value['target_id'] == $registration_type_id) {
      $registration_types
        ->removeItem($key);
    }
  }
  return $this->entity;
}