function _ad_get_vid in Advertisement 6.3
Same name and namespace in other branches
- 5.2 ad.module \_ad_get_vid()
- 5 ad.module \_ad_get_vid()
- 6 ad.module \_ad_get_vid()
- 6.2 ad.module \_ad_get_vid()
- 7 ad.module \_ad_get_vid()
Creates a vocabulary for use by ad groups if not already created.
11 calls to _ad_get_vid()
- ad_admin_groups_list in ./
ad.admin.inc - ad_admin_group_form in ./
ad.admin.inc - Returns a form for adding an ad group.
- ad_channel_admin_channel in channel/
ad_channel.module - Administrative page for creating or editing channels.
- ad_channel_admin_channel_submit in channel/
ad_channel.module - Save the channel.
- ad_filters in ./
ad.admin.inc - List ad administration filters that can be applied.
File
- ./
ad.module, line 1418
Code
function _ad_get_vid() {
$vid = variable_get('ad_group_vid', '');
if (empty($vid)) {
// No vid stored in the variables table, check if one even exists.
$vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = '%s'", 'ad'));
if (!$vid) {
// No vid, so we create one.
$edit = array(
'name' => t('Ad groups'),
'multiple' => 1,
'required' => 0,
'hierarchy' => 0,
'relations' => 0,
'module' => 'ad',
'nodes' => array(
'ad' => 1,
),
);
taxonomy_save_vocabulary($edit);
$vid = $edit['vid'];
}
// Save the vid for next time.
variable_set('ad_group_vid', $vid);
}
return $vid;
}