You are here

public function WeightNodeHandler::prepare in Weight 7.2

File

./weight.migrate.inc, line 37
Migrate support for weight.

Class

WeightNodeHandler

Code

public function prepare($entity, stdClass $row) {
  $settings = _weight_get_settings($entity->type);
  if (!empty($settings) && $settings['enabled']) {

    // Use the mapped entity value to populate the real value
    if (isset($entity->weight)) {
      $entity->weight_weight = $entity->weight;
      unset($entity->weight);
    }
    else {
      $entity->weight_weight = $settings['default'];
    }
  }
}