You are here

public function ContentImport::getTermId in Content Import 8

Same name and namespace in other branches
  1. 8.3 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::getTermId()
  2. 8.4 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::getTermId()

To get Termid available.

2 calls to ContentImport::getTermId()
ContentImport::createTerm in src/Form/ContentImport.php
To Create Terms if it is not available.
ContentImport::getTermReference in src/Form/ContentImport.php
To get Reference field ids.

File

src/Form/ContentImport.php, line 161
Contains \Drupal\contentimport\Form\ContentImport.

Class

ContentImport
Configure Content Import settings for this site.

Namespace

Drupal\contentimport\Form

Code

public function getTermId($term, $vid) {
  $termRes = db_query('SELECT n.tid FROM {taxonomy_term_field_data} n WHERE n.name  = :uid AND n.vid  = :vid', array(
    ':uid' => $term,
    ':vid' => $vid,
  ));
  foreach ($termRes as $val) {
    $term_id = $val->tid;
  }
  return $term_id;
}