function 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 336

Class

TermStorage
Defines a Controller class for taxonomy terms.

Namespace

Drupal\taxonomy

Code

public function resetWeights($vid) {
  $this->database
    ->update($this->getDataTable())
    ->fields([
    'weight' => 0,
  ])
    ->condition('vid', $vid)
    ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.