Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions notify_entity.info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Notify Entity
type: module
description: 'Simple module to allow email notification for entity insert, update and delete.'
core_version_requirement: ^10

version: '8.x-0.1'
core: '8.x'
9 changes: 5 additions & 4 deletions notify_entity.module
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@



use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_entity_insert().
*/
function notify_entity_entity_insert(Drupal\Core\Entity\EntityInterface $entity) {
function notify_entity_entity_insert(EntityInterface $entity) {
_notify_entity_trigger_event('insert', $entity);
}


/**
* Implements hook_entity_delete().
*/
function notify_entity_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
function notify_entity_entity_delete(EntityInterface $entity) {
_notify_entity_trigger_event('delete', $entity);
}


/**
* Implements hook_entity_update().
*/
function notify_entity_entity_update(Drupal\Core\Entity\EntityInterface $entity) {
function notify_entity_entity_update(EntityInterface $entity) {
_notify_entity_trigger_event('update', $entity);
}

Expand All @@ -32,7 +33,7 @@ function notify_entity_entity_update(Drupal\Core\Entity\EntityInterface $entity)
* @param String $event A string to represent the event.
* @param \Drupal\Core\Entity\EntityInterface $entity The triggering entity.
*/
function _notify_entity_trigger_event($event, Drupal\Core\Entity\EntityInterface $entity) {
function _notify_entity_trigger_event($event, EntityInterface $entity) {
$config = \Drupal::configFactory()->get('notify_entity.settings');
$key = _notify_entity_make_key($entity->getEntityTypeId(), $entity->bundle());

Expand Down
2 changes: 1 addition & 1 deletion src/Form/NotifyEntityForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {

$form['#tree'] = TRUE;

$entities = \Drupal::entityManager()->getAllBundleInfo();
$entities = \Drupal::service('entity_type.bundle.info')->getAllBundleInfo();
foreach ($entities as $entity_type => $bundles) {
foreach ($bundles as $bundle_type => $bundle_info) {
$form['settings'][$entity_type][$bundle_type] = $this->formCreateRow(
Expand Down