You are here

function _node_gallery_api_create_new_gallery in Node Gallery 7

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

Parameters

string $content_type: The content type of the new node.

Return value

The completed node object.

1 call to _node_gallery_api_create_new_gallery()
node_gallery_api_create_new_gallery_submit in ./node_gallery_api.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.

File

./node_gallery_api.module, line 469
Node Gallery module.

Code

function _node_gallery_api_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;
}