You are here

private static function Terms::updateExistingTerm in Hook Update Deploy Tools 7

Update an existing term from the imported object.

Parameters

object $term_import: The Term object from the import file.

object $term_existing: The Term object for the existing Term.

Return value

object The Term from term_save, broken free of reference to $term_import.

1 call to Terms::updateExistingTerm()
Terms::importOne in src/Terms.php
Validated Updates/Imports one term from the contents of an import file.

File

src/Terms.php, line 431

Class

Terms
Public methods for dealing with Vocabularies.

Namespace

HookUpdateDeployTools

Code

private static function updateExistingTerm($term_import, $term_existing) {
  $saved_term = clone $term_import;
  $saved_term->tid = $term_existing->tid;

  // @TODO Need to add handling for field collections.
  // @TODO Need to add handling for entity reference.
  // Entity reference works as long as the entity being referenced exists and
  // has the same entity id as the one being referenced.
  taxonomy_term_save($saved_term);
  return $saved_term;
}