function Node::preDelete
Same name in other branches
- 9 core/modules/node/src/Entity/Node.php \Drupal\node\Entity\Node::preDelete()
- 8.9.x core/modules/node/src/Entity/Node.php \Drupal\node\Entity\Node::preDelete()
- 11.x core/modules/node/src/Entity/Node.php \Drupal\node\Entity\Node::preDelete()
Overrides EntityBase::preDelete
File
-
core/
modules/ node/ src/ Entity/ Node.php, line 164
Class
- Node
- Defines the node entity class.
Namespace
Drupal\node\EntityCode
public static function preDelete(EntityStorageInterface $storage, array $entities) {
parent::preDelete($storage, $entities);
// Ensure that all nodes deleted are removed from the search index.
if (\Drupal::hasService('search.index')) {
/** @var \Drupal\search\SearchIndexInterface $search_index */
$search_index = \Drupal::service('search.index');
foreach ($entities as $entity) {
$search_index->clear('node_search', $entity->nid->value);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.