You are here

function yamlform_entity_delete in YAML Form 8

Implements hook_entity_delete().

File

./yamlform.module, line 194
Enables the creation of forms and questionnaires.

Code

function yamlform_entity_delete(EntityInterface $entity) {

  // Delete saved export settings for a form or source entity with the
  // yamlform field.
  if ($entity instanceof YamlFormInterface || method_exists($entity, 'hasField') && $entity
    ->hasField('yamlform')) {
    $name = 'yamlform.export.' . $entity
      ->getEntityTypeId() . '.' . $entity
      ->id();
    \Drupal::state()
      ->delete($name);
  }
}