You are here

function taxonomy_entity_load in Deploy - Content Staging 7.2

Same name and namespace in other branches
  1. 7.3 deploy.core.inc \taxonomy_entity_load()

Implements hook_entity_load().

The 'parent' property isn't attached when terms are loaded. Deploy needs that variable to correctly deploy terms.

Related topics

File

./deploy.core.inc, line 18
Deploy module functions for core entities.

Code

function taxonomy_entity_load(&$entities, $entity_type) {
  if ($entity_type == 'taxonomy_term') {
    foreach ($entities as &$entity) {
      if (!isset($entity->parent)) {
        $parents = taxonomy_get_parents($entity->tid);
        if (!empty($parents)) {
          $entity->parent = array();
          foreach ($parents as $parent) {
            $entity->parent[] = $parent->tid;
          }
        }
      }
    }
  }
}