You are here

public function RngEventType::delete in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 3.x src/Entity/RngEventType.php \Drupal\rng\Entity\RngEventType::delete()

Deletes an entity permanently.

Throws

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

Overrides EntityBase::delete

File

src/Entity/RngEventType.php, line 472

Class

RngEventType
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();
}