src/Drupal/Driver/Cores/Drupal6.php 1 location
|
@@ 352-358 (lines=7) @@
|
| 349 |
|
} |
| 350 |
|
|
| 351 |
|
// If `parent` is set, look up a term in this vocab with that name. |
| 352 |
|
if (isset($term->parent)) { |
| 353 |
|
$parent = \taxonomy_get_term_by_name($term->parent); |
| 354 |
|
if (!empty($parent)) { |
| 355 |
|
$parent = reset($parent); |
| 356 |
|
$term->parent = $parent->tid; |
| 357 |
|
} |
| 358 |
|
} |
| 359 |
|
|
| 360 |
|
if (empty($term->vid)) { |
| 361 |
|
throw new \Exception(sprintf('No "%s" vocabulary found.')); |
src/Drupal/Driver/Cores/Drupal7.php 1 location
|
@@ 307-313 (lines=7) @@
|
| 304 |
|
} |
| 305 |
|
|
| 306 |
|
// If `parent` is set, look up a term in this vocab with that name. |
| 307 |
|
if (isset($term->parent)) { |
| 308 |
|
$parent = \taxonomy_get_term_by_name($term->parent, $term->vocabulary_machine_name); |
| 309 |
|
if (!empty($parent)) { |
| 310 |
|
$parent = reset($parent); |
| 311 |
|
$term->parent = $parent->tid; |
| 312 |
|
} |
| 313 |
|
} |
| 314 |
|
|
| 315 |
|
if (empty($term->vid)) { |
| 316 |
|
throw new \Exception(sprintf('No "%s" vocabulary found.')); |
src/Drupal/Driver/Cores/Drupal8.php 1 location
|
@@ 314-320 (lines=7) @@
|
| 311 |
|
public function termCreate(\stdClass $term) { |
| 312 |
|
$term->vid = $term->vocabulary_machine_name; |
| 313 |
|
|
| 314 |
|
if (isset($term->parent)) { |
| 315 |
|
$parent = \taxonomy_term_load_multiple_by_name($term->parent, $term->vocabulary_machine_name); |
| 316 |
|
if (!empty($parent)) { |
| 317 |
|
$parent = reset($parent); |
| 318 |
|
$term->parent = $parent->id(); |
| 319 |
|
} |
| 320 |
|
} |
| 321 |
|
|
| 322 |
|
$this->expandEntityFields('taxonomy_term', $term); |
| 323 |
|
$entity = Term::create((array) $term); |