You are here

public function EventType::delete in RNG - Events and Registrations 8

Deletes an entity permanently.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.

Overrides EntityBase::delete

File

src/Entity/EventType.php, line 418

Class

EventType
Defines the event type entity.

Namespace

Drupal\rng\Entity

Code

public function delete() {
  foreach ($this->fields as $field) {
    $field = FieldConfig::loadByName($this
      ->getEventEntityTypeId(), $this
      ->getEventBundle(), $field);
    if ($field) {
      $field
        ->delete();
    }
    $display = entity_get_form_display($this->entity_type, $this->bundle, 'rng_event');
    if (!$display
      ->isNew()) {
      $display
        ->delete();
    }
  }
  parent::delete();
}