You are here

function node_gallery_json_create_gallery in Node Gallery 6.3

Javascript page callback to create an empty gallery.

Parameters

String $gallery_type: The type of the gallery to create.

Return value

Json encoded newly created gallery.

1 string reference to 'node_gallery_json_create_gallery'
node_gallery_menu in ./node_gallery.module
Implements hook_menu().

File

./node_gallery.pages.inc, line 28
Handles displaying of Node gallery pages.

Code

function node_gallery_json_create_gallery($gallery_type, $token) {
  if (!drupal_valid_token($token, 'node_gallery_plupload')) {
    drupal_access_denied();
    return;
  }
  $gallery = (object) array(
    'type' => $gallery_type,
  );
  if (!node_gallery_user_access('create', $gallery)) {
    return drupal_json(array(
      'is_error' => 1,
      'message' => t("You don't have permission to create a gallery."),
    ));
  }
  $gallery = _node_gallery_create_new_gallery($gallery_type);
  drupal_json($gallery);
}