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/Drupal8.php 1 location
|
@@ 336-342 (lines=7) @@
|
333 |
|
public function termCreate(\stdClass $term) { |
334 |
|
$term->vid = $term->vocabulary_machine_name; |
335 |
|
|
336 |
|
if (isset($term->parent)) { |
337 |
|
$parent = \taxonomy_term_load_multiple_by_name($term->parent, $term->vocabulary_machine_name); |
338 |
|
if (!empty($parent)) { |
339 |
|
$parent = reset($parent); |
340 |
|
$term->parent = $parent->id(); |
341 |
|
} |
342 |
|
} |
343 |
|
|
344 |
|
$this->expandEntityFields('taxonomy_term', $term); |
345 |
|
$entity = Term::create((array) $term); |
src/Drupal/Driver/Cores/Drupal7.php 1 location
|
@@ 302-308 (lines=7) @@
|
299 |
|
} |
300 |
|
|
301 |
|
// If `parent` is set, look up a term in this vocab with that name. |
302 |
|
if (isset($term->parent)) { |
303 |
|
$parent = \taxonomy_get_term_by_name($term->parent, $term->vocabulary_machine_name); |
304 |
|
if (!empty($parent)) { |
305 |
|
$parent = reset($parent); |
306 |
|
$term->parent = $parent->tid; |
307 |
|
} |
308 |
|
} |
309 |
|
|
310 |
|
if (empty($term->vid)) { |
311 |
|
throw new \Exception(sprintf('No "%s" vocabulary found.', $term->vocabulary_machine_name)); |