You are here

function premium_node_import_prepare in Node import 5

Implementation of hook_node_import_prepare().

File

supported/premium.inc, line 17

Code

function premium_node_import_prepare(&$node, $preview = FALSE) {
  $errors = array();

  // The user may have enabled it for this content type.
  $premium = in_array('premium', (array) variable_get('node_options_' . $node->type, array())) ? 1 : 0;

  // Alternatively, she may have enabled it during import.
  if (isset($node->node_import_premium)) {
    $premium = $node->node_import_premium;
    unset($node->node_import_premium);
  }

  // If the premium field was mapped, use that value instead.
  if (isset($node->premium) && strlen($node->premium) > 0) {
    $premium = $node->premium ? 1 : 0;
  }
  $node->premium = $premium;
  return $errors;
}