Skip to content
Snippets Groups Projects

Issue #2928661 by kriboogh: Reordering taxonomy terms after "Reset to...

Files
3
@@ -2,6 +2,7 @@
namespace Drupal\taxonomy;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Entity\Sql\TableMappingInterface;
@@ -322,6 +323,22 @@ public function resetWeights($vid) {
->fields(['weight' => 0])
->condition('vid', $vid)
->execute();
// Reset terms for this vocabulary. We don't use loadMultiple for
// performance reasons and limit memory consumption.
$entity_type_key = $this->getEntityType()->getKey('bundle');
$term_ids = $this->getQuery()
->accessCheck(FALSE)
->condition($entity_type_key, $vid)
->execute();
$this->resetCache($term_ids);
// Invalidate the taxonomy term cache tags.
array_walk($term_ids, function (&$tid) {
$tid = 'taxonomy_term:' . $tid;
});
Cache::invalidateTags($term_ids);
}
/**
Loading