You are here

protected function InstallHelper::getTermId in Drupal 8

Same name and namespace in other branches
  1. 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::getTermId()
  2. 10 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.

2 calls to InstallHelper::getTermId()
InstallHelper::processArticle in core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php
Process article data into article node structure.
InstallHelper::processRecipe in core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php
Process recipe data into recipe node structure.

File

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

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;
}