Taxonomy - Search & Update Terms mit PHP - Drupal 8

Submitted by Gast (nicht überprüft) on Mi, 11/13/2019 - 22:09

Update Taxonomy Vocabulary : Alle Terms

 <?php

$query = \Drupal::entityQuery('taxonomy_term');
  $query->condition('vid', 'my_taxonomy_vocabulary');
  $result = $query->execute();

  foreach($result as $term_id) {
    $term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($term_id);
    $term_name = $term->getName();
    $value = $term_name . " added new value";
    $term->setName($value);
    $term->save(); 
  }

 

 

Neuen Kommentar schreiben

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.