| @@ 355-361 (lines=7) @@ | ||
| 352 | } |
|
| 353 | ||
| 354 | // If `parent` is set, look up a term in this vocab with that name. |
|
| 355 | if (isset($term->parent)) { |
|
| 356 | $parent = \taxonomy_get_term_by_name($term->parent); |
|
| 357 | if (!empty($parent)) { |
|
| 358 | $parent = reset($parent); |
|
| 359 | $term->parent = $parent->tid; |
|
| 360 | } |
|
| 361 | } |
|
| 362 | ||
| 363 | if (empty($term->vid)) { |
|
| 364 | throw new \Exception(sprintf('No "%s" vocabulary found.')); |
|
| @@ 400-406 (lines=7) @@ | ||
| 397 | } |
|
| 398 | ||
| 399 | // If `parent` is set, look up a term in this vocab with that name. |
|
| 400 | if (isset($term->parent)) { |
|
| 401 | $parent = \taxonomy_get_term_by_name($term->parent, $term->vocabulary_machine_name); |
|
| 402 | if (!empty($parent)) { |
|
| 403 | $parent = reset($parent); |
|
| 404 | $term->parent = $parent->tid; |
|
| 405 | } |
|
| 406 | } |
|
| 407 | ||
| 408 | if (empty($term->vid)) { |
|
| 409 | throw new \Exception(sprintf('%s::%s line %s: Could not load term.', get_class($this), __FUNCTION__, __LINE__)); |
|