| @@ 376-382 (lines=7) @@ | ||
| 373 | } |
|
| 374 | ||
| 375 | // If `parent` is set, look up a term in this vocab with that name. |
|
| 376 | if (isset($term->parent)) { |
|
| 377 | $parent = \taxonomy_get_term_by_name($term->parent); |
|
| 378 | if (!empty($parent)) { |
|
| 379 | $parent = reset($parent); |
|
| 380 | $term->parent = $parent->tid; |
|
| 381 | } |
|
| 382 | } |
|
| 383 | ||
| 384 | if (empty($term->vid)) { |
|
| 385 | throw new \Exception(sprintf('No "%s" vocabulary found.')); |
|
| @@ 408-414 (lines=7) @@ | ||
| 405 | } |
|
| 406 | ||
| 407 | // If `parent` is set, look up a term in this vocab with that name. |
|
| 408 | if (isset($term->parent)) { |
|
| 409 | $parent = \taxonomy_get_term_by_name($term->parent, $term->vocabulary_machine_name); |
|
| 410 | if (!empty($parent)) { |
|
| 411 | $parent = reset($parent); |
|
| 412 | $term->parent = $parent->tid; |
|
| 413 | } |
|
| 414 | } |
|
| 415 | ||
| 416 | if (empty($term->vid)) { |
|
| 417 | throw new \Exception(sprintf('%s::%s line %s: Could not load term.', get_class($this), __FUNCTION__, __LINE__)); |
|