'taxonomy:'. $array['tid'])); } break; case 'delete': $locations = array(); location_save_locations($locations, array('genid' => 'taxonomy:'. $array['tid'])); break; } } } /** * Implementation of hook_form_alter(). */ function location_taxonomy_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'taxonomy_form_vocabulary') { $settings = array(); if (isset($form['vid'])) { $settings = variable_get('location_taxonomy_'. $form['vid']['#value'], array()); } $form['location_settings'] = location_settings($settings); } if ($form_id == 'taxonomy_form_term') { $vid = $form['vid']['#value']; $settings = variable_get('location_taxonomy_'. $vid, FALSE); if ($settings && $settings['multiple']['max']) { $locations = array(); if (isset($form['tid']) && $form['tid']['#value']) { $locations = location_load_locations('taxonomy:'. $form['tid']['#value'], 'genid'); } $form['locations'] = location_form($settings, $locations); } } // 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; } } } } /** * Implementation of hook_locationapi(). */ function location_taxonomy_locationapi(&$obj, $op, $a3 = NULL, $a4 = NULL, $a5 = NULL) { switch ($op) { case 'instance_links': foreach ($obj as $k => $v) { if (substr($v['genid'], 0, 9) == 'taxonomy:') { $data = explode(':', $v['genid']); $obj[$k]['href'] = 'taxonomy/term/'. $data[1]; $obj[$k]['title'] = t('Term location'); $obj[$k]['type'] = t('Taxonomy location'); } } } }