Taxonomy Term : create programmatically (Drupal)

Submitted by Gast (nicht überprüft) on Di, 06/07/2022 - 10:55

Create Taxonomy Term (in Vocabulary): 

use Drupal\taxonomy\Entity\Term;

$new_term = Term::create([
  'vid' => 'name_of_the_vocabulary',
  'name' => 'name of the term',
]);

$new_term->enforceIsNew();
$new_term->save();

 

Neuen Kommentar schreiben

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