Skip to content

Commit

Permalink
Delete unpublished node from Algolia (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish authored Sep 24, 2024
1 parent e8cf252 commit 37841f1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions stanford_profile_helper.module
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ function stanford_profile_helper_plugin_filter_block__layout_builder_alter(array
}
}

/**
* Implements hook_entity_delete().
*
*/
/**
* Implements hook_ENTITY_TYPE_update().
*/
function stanford_profile_helper_node_update(NodeInterface $node) {
if (!$node->isPublished() && $node->original?->isPublished() && \Drupal::hasService('search_api_algolia.helper')) {
// Trigger algolia to delete the record.
\Drupal::service('search_api_algolia.helper')->entityDelete($node);
}
}

/**
* Implements hook_cron().
Expand Down

0 comments on commit 37841f1

Please sign in to comment.