You are here

function node_gallery_list_galleries in Node Gallery 6.3

Displays the gallery summary page, which is a user-specified view.

Parameters

$user: (optional) A user object, defaults to NULL. If present, displays only galleries owned by that user.

$content_type: (optional) A gallery content type. If present, the view only displays galleries of this type.

Return value

HTML Output

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

File

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

Code

function node_gallery_list_galleries($user = NULL, $content_type = NULL) {
  if (!$user) {
    $user = NULL;
  }
  else {
    node_gallery_set_breadcrumb(array(
      'galleries',
    ));
  }
  if (!$content_type) {
    $content_type = NULL;
  }
  $viewkey = unserialize(variable_get('node_gallery_galleries_summary_view', serialize(array(
    'name' => 'node_gallery_gallery_summaries',
    'display_id' => 'page_1',
  ))));

  // When there's no user, use the view title in the all galleries list.
  if (is_null($user)) {
    $view = views_get_view($viewkey['name']);
    $title = $view->display[$viewkey['display_id']]->display_options['title'];
    if (!empty($title)) {
      drupal_set_title(check_plain($title));
    }
  }

  // @todo: we should be able to programmatically set some options on the view, such as number of images, imagefield_name, etc.
  $output = views_embed_view($viewkey['name'], $viewkey['display_id'], $user->uid, $content_type);
  return $output;
}