function gmap_taxonomy_form_alter in GMap Module 7.2
Same name and namespace in other branches
- 5 gmap_taxonomy.module \gmap_taxonomy_form_alter()
- 6.2 gmap_taxonomy.module \gmap_taxonomy_form_alter()
- 6 gmap_taxonomy.module \gmap_taxonomy_form_alter()
- 7 gmap_taxonomy.module \gmap_taxonomy_form_alter()
Implements hook_form_alter().
@todo move this to GmapTaxonomyForms class
File
- ./
gmap_taxonomy.module, line 15 - GMap Taxonomy Markers
Code
function gmap_taxonomy_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'taxonomy_form_vocabulary') {
$form['gmap_taxonomy'] = array(
'#type' => 'fieldset',
'#title' => t('GMap markers'),
);
$vid = isset($form['vid']) ? $form['vid']['#value'] : -1;
$form['gmap_taxonomy']['gmap_taxonomy_enable'] = array(
'#type' => 'checkbox',
'#title' => t('Enable'),
'#description' => t('Enable choosing a marker for terms in this vocabulary.'),
'#default_value' => gmap_taxonomy_vocabulary_is_enabled($vid),
);
}
// @@@ Why does this get called up on delete?
if ($form_id == 'taxonomy_form_term' && empty($form['confirm']['#value'])) {
$term = (object) $form['#term'];
if (gmap_taxonomy_vocabulary_is_enabled($form['#vocabulary'])) {
$temp = '';
if (!empty($term->tid)) {
if ($t = db_query('SELECT marker FROM {gmap_taxonomy_term} WHERE tid = :tid', array(
':tid' => $term->tid,
))
->fetchField()) {
$temp = $t;
}
}
$form['gmap_taxonomy_marker'] = array(
'#title' => t('GMap Marker'),
'#type' => 'select',
'#options' => array(
'' => t('No Marker'),
) + gmap_get_marker_titles(),
'#description' => t('If you would like nodes tagged as this term to have a special marker, choose one here.'),
'#default_value' => $temp,
);
}
}
// Move the Save and Delete buttons down below our additions.
/*
if ($form_id == 'taxonomy_form_vocabulary'
|| $form_id == 'taxonomy_form_term') {
if (isset($form['submit']['#weight'])) {
$form['submit']['#weight']++;
}
else {
$form['submit']['#weight'] = 1;
}
if (isset($form['delete'])) {
if (isset($form['delete']['#weight'])) {
$form['delete']['#weight']+=2;
}
else {
$form['delete']['#weight'] = 2;
}
}
}
*/
}