You are here

protected function InstallHelper::getTermId in Drupal 10

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::getTermId()
  2. 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::getTermId()

Retrieves the Term ID of a term saved during the import process.

Parameters

string $vocabulary: Machine name of vocabulary to which it was saved.

int $term_csv_id: The term's ID from the CSV file.

Return value

int Term ID, or 0 if Term ID could not be found.

File

core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php, line 207

Class

InstallHelper
Defines a helper class for importing default content.

Namespace

Drupal\demo_umami_content

Code

protected function getTermId($vocabulary, $term_csv_id) {
  if (array_key_exists($vocabulary, $this->termIdMap) && array_key_exists($term_csv_id, $this->termIdMap[$vocabulary])) {
    return $this->termIdMap[$vocabulary][$term_csv_id];
  }
  return 0;
}