materio_ai: requeue nodes when a referenced term changes (V7)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ShDspHaZGwHoRZCsPBJzsM
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\taxonomy\TermInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_insert() for node.
|
||||
@@ -40,3 +41,28 @@ function materio_ai_node_translation_delete(NodeInterface $translation): void {
|
||||
function materio_ai_node_delete(NodeInterface $node): void {
|
||||
\Drupal::service('materio_ai.embedding_storage')->delete((int) $node->id());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_update() for taxonomy_term.
|
||||
*
|
||||
* A renamed tag, thesaurus term or company changes the text of its nodes.
|
||||
*/
|
||||
function materio_ai_taxonomy_term_update(TermInterface $term): void {
|
||||
\Drupal::service('materio_ai.vectorizer')->enqueueForTerm($term);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_translation_delete() for taxonomy_term.
|
||||
*/
|
||||
function materio_ai_taxonomy_term_translation_delete(TermInterface $translation): void {
|
||||
\Drupal::service('materio_ai.vectorizer')->enqueueForTerm($translation, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_predelete() for taxonomy_term.
|
||||
*
|
||||
* Predelete: the node references still exist, so the nodes can be found.
|
||||
*/
|
||||
function materio_ai_taxonomy_term_predelete(TermInterface $term): void {
|
||||
\Drupal::service('materio_ai.vectorizer')->enqueueForTerm($term, TRUE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user