function ad_form_alter in Advertisement 6.3
Same name and namespace in other branches
- 5.2 ad.module \ad_form_alter()
- 5 ad.module \ad_form_alter()
- 6 ad.module \ad_form_alter()
- 6.2 ad.module \ad_form_alter()
- 7 ad.module \ad_form_alter()
Implementation of hook_form_alter().
File
- ./
ad.module, line 768
Code
function ad_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'taxonomy_form_vocabulary') {
// Remove taxonomy form options not applicable for ad groups.
if ($form['vid']['#value'] == _ad_get_vid()) {
$form['help_ad_vocab'] = array(
'#value' => t('This vocabulary was automatically created for use by the ad module. Only applicable options are available.'),
'#weight' => -1,
);
$form['nodes']['ad'] = array(
'#type' => 'checkbox',
'#title' => t('ad group'),
'#value' => 1,
'#attributes' => array(
'disabled' => '',
),
'#description' => t('Type %type is required to use this vocabulary.', array(
'%type' => t('ad group'),
)),
);
$form['tags']['#description'] = t('If enabled, ads are categorized by typing ad group names instead of choosing them from a list.');
$form['multiple']['#description'] = t('If enabled, allows ads to have more than one ad group (always true for free tagging).');
$form['required']['#description'] = t('If enabled, every ad <strong>must</strong> be assigned to at least one ad group.');
$form['hierarchy'] = array(
'#type' => 'value',
'#value' => 0,
);
unset($form['relations']);
}
else {
unset($form['nodes']['ad']);
}
}
else {
if ($form_id == 'taxonomy_form_term') {
if ($form['vid']['#value'] == _ad_get_vid()) {
$form['name']['#title'] = t('Ad group name');
$form['name']['#description'] = t('The name for this ad group. Example: "Linux".');
$form['description']['#description'] = t('A description of the ad group.');
$form['description']['#required'] = TRUE;
$form['weight']['#description'] = t('In listings, the heavier ad groups will sink and the lighter ad groups will be positioned nearer the top.');
unset($form['synonyms']);
}
}
else {
if ($form_id == 'search_form' && variable_get('ad_no_search', 1) && !user_access('administer advertisements') && !user_access('administer any advertisement')) {
$vid = _ad_get_vid();
$vocabulary = db_result(db_query('SELECT name FROM {vocabulary} WHERE vid = %d', $vid));
unset($form['advanced']['category']['#options'][$vocabulary]);
if (empty($form['advanced']['category']['#options'])) {
unset($form['advanced']['category']);
}
unset($form['advanced']['type']['#options']['ad']);
}
}
}
}