You are here

function menu_import_create_node in Menu Export/Import 7

Create new node of given content type.

Parameters

$options: Array relevant array keys are:

  • node_title
  • node_type
  • node_body
  • node_author
  • node_status

Return value

Node's nid field.

1 call to menu_import_create_node()
menu_import_save_menu in includes/import.inc
Import menu items.

File

includes/import.inc, line 538
Import functions for menu_import module.

Code

function menu_import_create_node($options) {
  $node = new stdClass();
  $node->type = $options['node_type'];
  $node->language = $options['language'];
  $node->title = $options['node_title'];
  $body_lang = _menu_import_body_is_translatable() ? $node->language : LANGUAGE_NONE;
  $node->body[$body_lang][0]['value'] = $options['node_body'];
  $node->body[$body_lang][0]['summary'] = text_summary($options['node_body']);
  $node->body[$body_lang][0]['format'] = $options['node_format'];
  $node->status = $options['node_status'];
  $node->uid = $options['node_author'];
  if (!empty($options['path_alias'])) {
    $node->path = array(
      'alias' => $options['path_alias'],
    );

    // Make sure pathauto is not being used
    if (module_exists('pathauto')) {
      $node->path['pathauto'] = FALSE;
    }
  }
  node_save($node);
  return $node->nid;
}