Created
March 21, 2018 15:29
-
-
Save slivorezka/7ed96aeb83d2fb68009641fcc867fbdd to your computer and use it in GitHub Desktop.
Drupal 8: Reset weigh for all terms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$manager = \Drupal::entityTypeManager()->getStorage('taxonomy_term'); | |
$tree = $manager->loadTree('VOC_NAME', 0, 0, TRUE); | |
foreach ($tree as $term) { | |
$term->setWeight(0); | |
$term->save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment