Skip to main content
Rollback to Revision 1 - Edit approval overridden by post owner or moderator
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term)->save();

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term)->save();

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term);

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term)->save();

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term);

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term)->save();
Source Link

With entityTypeManager():

$term = [
  'name'     => $name,
  'vid'      => $vocabulary,
  'langcode' => $language,
];

$term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->create($term);