Skip to content
Snippets Groups Projects

Issue #3408925: Added insert/update/delete hooks for domain path entity to...

1 file
+ 31
0
Compare changes
  • Side-by-side
  • Inline
+ 31
0
@@ -6,6 +6,7 @@
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\domain_path\DomainPathInterface;
/**
* Implements hook_form_alter().
@@ -36,3 +37,33 @@ function domain_path_entity_delete(EntityInterface $entity) {
function domain_path_entity_translation_delete(EntityInterface $translation) {
\Drupal::service('domain_path.helper')->deleteEntityDomainPaths($translation);
}
/**
* Implements hook_ENTITY_TYPE_insert().
*/
function domain_path_domain_path_insert(DomainPathInterface $path) {
if (\Drupal::hasService('decoupled_router.cache_invalidation')) {
\Drupal::service('decoupled_router.cache_invalidation')
->invalidateByPath(['source' => $path->getAlias()]);
}
}
/**
* Implements hook_ENTITY_TYPE_update().
*/
function domain_path_domain_path_update(DomainPathInterface $path) {
if (\Drupal::hasService('decoupled_router.cache_invalidation')) {
\Drupal::service('decoupled_router.cache_invalidation')
->invalidateByPath(['source' => $path->getAlias()]);
}
}
/**
* Implements hook_ENTITY_TYPE_delete().
*/
function domain_path_domain_path_delete(DomainPathInterface $path) {
if (\Drupal::hasService('decoupled_router.cache_invalidation')) {
\Drupal::service('decoupled_router.cache_invalidation')
->invalidateByPath(['source' => $path->getAlias()]);
}
}
Loading