You are here

function _image_gallery_get_vid in Image 5.2

Same name and namespace in other branches
  1. 5 contrib/image_gallery/image_gallery.module \_image_gallery_get_vid()
  2. 6 contrib/image_gallery/image_gallery.module \_image_gallery_get_vid()
  3. 7 contrib/image_gallery/image_gallery.module \_image_gallery_get_vid()

Returns (and possibly creates) a new vocabulary for Image galleries.

6 calls to _image_gallery_get_vid()
image_gallery_admin in contrib/image_gallery/image_gallery.module
image_gallery_admin_form in contrib/image_gallery/image_gallery.module
image_gallery_nodeapi in contrib/image_gallery/image_gallery.module
image_gallery_page in contrib/image_gallery/image_gallery.module
Image gallery callback, displays an image gallery
image_gallery_views_default_views in contrib/image_gallery/views_defaults.inc
Implementation of hook_views_default_views().

... See full list

File

contrib/image_gallery/image_gallery.module, line 483

Code

function _image_gallery_get_vid() {
  $vid = variable_get('image_gallery_nav_vocabulary', '');
  if (empty($vid) || !taxonomy_get_vocabulary($vid)) {

    // Check to see if an image gallery vocabulary exists
    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module='image_gallery'"));
    if (!$vid) {
      $vocabulary = array(
        'name' => t('Image Galleries'),
        'multiple' => '0',
        'required' => '0',
        'hierarchy' => '1',
        'relations' => '0',
        'module' => 'image_gallery',
        'nodes' => array(
          'image' => 1,
        ),
      );
      taxonomy_save_vocabulary($vocabulary);
      $vid = $vocabulary['vid'];
    }
    variable_set('image_gallery_nav_vocabulary', $vid);
  }
  return $vid;
}