You are here

function _node_gallery_create_new_gallery in Node Gallery 6.3

Given a content type, creates a new gallery node, returning the node object.

Parameters

$content_type: The content type of the new node.

Return value

The completed node object.

2 calls to _node_gallery_create_new_gallery()
node_gallery_create_new_gallery_submit in ./node_gallery.module
If the user selected the option to create a new gallery, create a stub gallery, assign the images to that gallery, and redirect them to the gallery edit form.
node_gallery_json_create_gallery in ./node_gallery.pages.inc
Javascript page callback to create an empty gallery.

File

./node_gallery.inc, line 949
Shared functions for node_gallery

Code

function _node_gallery_create_new_gallery($content_type) {
  global $user;
  module_load_include('inc', 'node', 'node.pages');
  $node = new stdClass();
  $node->type = $content_type;
  node_object_prepare($node);
  $node->title = 'Unnamed Gallery';
  $node->name = $user->name;
  node_save($node);
  return $node;
}