You are here

function defaultcontent_import_node in Default Content 7

Same name and namespace in other branches
  1. 7.2 defaultcontent.module \defaultcontent_import_node()

This function takes a node object from hook_defaultcontents and insert it into the db TODO: need to do something fun with files TODO: need to do something fun with node refs

2 calls to defaultcontent_import_node()
content_features_revert in ./defaultcontent.features.inc
Implements hook_features_revert().
defaultcontent_cron in ./defaultcontent.module
Implements hook_cron().

File

./defaultcontent.module, line 291
Module file for the Default content module which allow export and import of default content in a Drupal site.

Code

function defaultcontent_import_node($node) {
  $plugins = defaultcontent_get_alter_plugins();
  foreach ($plugins as $plugin) {
    $cb = isset($plugin['import_alter callback']) ? $plugin['import_alter callback'] : $plugin['name'] . '_import_alter';
    if (function_exists($cb)) {
      $cb($node);
    }
  }
  if (variable_get('node_content_enabled', FALSE)) {
    node_save($node);
  }
  foreach ($plugins as $plugin) {
    $cb = isset($plugin['post_import callback']) ? $plugin['post_import callback'] : $plugin['name'] . '_post_import';
    if (function_exists($cb)) {
      $cb($node);
    }
  }
}