You are here

function create_term in Content Import 8.9

To Create Terms if it is not available.

1 call to create_term()
get_term_reference in ./contentimport.module
To get Reference field ids.

File

./contentimport.module, line 83
Module file for Contentimport.

Code

function create_term($voc, $term, $vid) {
  Term::create([
    'parent' => [
      $voc,
    ],
    'name' => $term,
    'vid' => $vid,
  ])
    ->save();
  $termId = get_term_id($term, $vid);
  return $termId;
}