From 2252e6c5bd906f75d202dbf5890915a8a8a638b4 Mon Sep 17 00:00:00 2001 From: Stuart Rowlands Date: Sat, 20 Sep 2025 08:05:49 +1000 Subject: [PATCH] Added defensive early return for non-translatable entities. --- quant.module | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quant.module b/quant.module index 150bc31a..c6170b4a 100644 --- a/quant.module +++ b/quant.module @@ -154,13 +154,19 @@ function quant_entity_predelete(EntityInterface $entity) { return; } + // Only process content entities (nodes, users, taxonomy terms, etc.) + // Skip configuration entities (field configs, views, etc.) + if (!($entity instanceof \Drupal\Core\Entity\ContentEntityInterface)) { + return; + } + // This needs to not be a shutdown hook and also needs to be on // the predelete hook as the path alias is removed in the entity // delete clean-up. _quant_unpublish_entity($entity); // Handle any translations. - if (method_exists($entity, 'isTranslatable') && $entity->isTranslatable()) { + if (method_exists($entity, 'isTranslatable') && $entity->isTranslatable() && method_exists($entity, 'getTranslationLanguages')) { foreach ($entity->getTranslationLanguages() as $language) { if ($language->getId() != $entity->language()->getId()) { $translation = $entity->getTranslation($language->getId());