|
diff --git a/src/Controller/OmniaController.php b/src/Controller/OmniaController.php |
|
index 436d635..a3161ca 100644 |
|
--- a/src/Controller/OmniaController.php |
|
+++ b/src/Controller/OmniaController.php |
|
@@ -461,7 +461,7 @@ class OmniaController extends ControllerBase { |
|
} |
|
|
|
if (!empty($fields['tag_field'])) { |
|
- $mapped_tag_ids = $this->mapMultipleTermIds($tag_ids, 'tags'); |
|
+ $mapped_tag_ids = $this->mapMultipleTermIds($tag_ids); |
|
$media->set($fields['tag_field'], $mapped_tag_ids); |
|
} |
|
|
|
@@ -579,17 +579,21 @@ class OmniaController extends ControllerBase { |
|
* @return int |
|
* The drupal id of the term. |
|
*/ |
|
- protected function mapTermId($omnia_id, $vid) { |
|
- $result = $this->database->select('nexx_taxonomy_term_data', 'n') |
|
+ protected function mapTermId($omnia_id, $vid = NULL) { |
|
+ $query = $this->database->select('nexx_taxonomy_term_data', 'n') |
|
->fields('n', ['tid']) |
|
- ->condition('n.nexx_item_id', $omnia_id) |
|
- ->condition('n.vid', $vid) |
|
- ->execute(); |
|
+ ->condition('n.nexx_item_id', $omnia_id); |
|
|
|
- $drupal_id = $result->fetchField(); |
|
+ if (!empty($vid)) { |
|
+ $query->condition('n.vid', $vid); |
|
+ } |
|
+ $result = $query->execute(); |
|
|
|
- return $drupal_id; |
|
- } |
|
+ if ($tid = $result->fetchField()) { |
|
+ return $tid; |
|
+ } |
|
+ return FALSE; |
|
+ } |
|
|
|
/** |
|
* Map multiple omnia term ids to drupal term ids. |
|
@@ -602,7 +606,7 @@ class OmniaController extends ControllerBase { |
|
* @return int[] |
|
* Array of mapped drupal ids, might contain less ids then the input array. |
|
*/ |
|
- protected function mapMultipleTermIds(array $omnia_ids, $vid) { |
|
+ protected function mapMultipleTermIds(array $omnia_ids, $vid = NULL) { |
|
$drupal_ids = []; |
|
foreach ($omnia_ids as $omnia_id) { |
|
if (empty($omnia_id)) { |