You are here

function create_voc in Content Import 8.9

To Create Terms if it is not available.

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

File

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

Code

function create_voc($vid, $voc) {
  $vocabulary = Vocabulary::create([
    'vid' => $vid,
    'machine_name' => $vid,
    'name' => $voc,
  ]);
  $vocabulary
    ->save();
}