public function TermStorage::resetWeights in Drupal 10
Same name and namespace in other branches
- 8 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::resetWeights()
- 9 core/modules/taxonomy/src/TermStorage.php \Drupal\taxonomy\TermStorage::resetWeights()
Reset the weights for a given vocabulary ID.
Parameters
string $vid: Vocabulary ID to retrieve terms for.
Overrides TermStorageInterface::resetWeights
File
- core/
modules/ taxonomy/ src/ TermStorage.php, line 333
Class
- TermStorage
- Defines a Controller class for taxonomy terms.
Namespace
Drupal\taxonomyCode
public function resetWeights($vid) {
$this->database
->update($this
->getDataTable())
->fields([
'weight' => 0,
])
->condition('vid', $vid)
->execute();
}