Chris@0: /** Chris@0: * Implements hook_entity_insert(). Chris@0: */ Chris@0: function {{ machine_name }}_entity_insert(Drupal\Core\Entity\EntityInterface $entity) { Chris@0: // Insert the new entity into a fictional table of all entities. Chris@4: \Drupal::database()->insert('example_entity') Chris@0: ->fields([ Chris@0: 'type' => $entity->getEntityTypeId(), Chris@0: 'id' => $entity->id(), Chris@0: 'created' => REQUEST_TIME, Chris@0: 'updated' => REQUEST_TIME, Chris@0: ]) Chris@0: ->execute(); Chris@0: }