leshed_helpers_taxonomy_term_delete
This commit is contained in:
@@ -30,6 +30,24 @@ function leshed_helpers_taxonomy_term_update(EntityInterface $entity) {
|
|||||||
leshed_helpers_ensure_term_alias($entity);
|
leshed_helpers_ensure_term_alias($entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime l'alias d'URL quand un terme d'un vocabulaire géré est supprimé.
|
||||||
|
*/
|
||||||
|
function leshed_helpers_taxonomy_term_delete(EntityInterface $entity) {
|
||||||
|
if (!($entity instanceof TermInterface)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$vid = $entity->bundle();
|
||||||
|
if (!isset(LESHED_HELPERS_VOCABULARIES[$vid])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$internal_path = '/' . LESHED_HELPERS_VOCABULARIES[$vid] . '/' . $entity->id();
|
||||||
|
$storage = \Drupal::entityTypeManager()->getStorage('path_alias');
|
||||||
|
$storage->delete($storage->loadByProperties(['path' => $internal_path]));
|
||||||
|
}
|
||||||
|
|
||||||
function leshed_helpers_ensure_term_alias(EntityInterface $entity) {
|
function leshed_helpers_ensure_term_alias(EntityInterface $entity) {
|
||||||
if (!($entity instanceof TermInterface)) {
|
if (!($entity instanceof TermInterface)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user