I had the need to access the Node associated to a Taxonomy while I'm in Taxonomy Manager.
I created a new and small module called taxonomy_manager_node. Maybe would be better to extend "Taxonomy Node".
When the module is installed and active, In taxonomy manager will appear a new link titled "Go to the taxonomy node". It will appear behind the other link titled "Go to the term page".
This is the code.
function taxonomy_manager_node_form_alter(&$form, $form_state, $form_id) {
if ($form_id =="taxonomy_manager_form")
{
$tid = $form['term_data']['tid']['#value'];
$name = $form['term_data']['name']['#default_value'];
$nid = _taxonomynode_get_nid_from_tid($tid); // get the node id associated to the term
if($nid>0)
{
$options['attributes']['target'] ='_blank'; // open a new window
$options['html'] =true;
$module_path = drupal_get_path('module', 'taxonomy_manager') .'/';
$link_img = theme("image", $module_path ."images/link-small.png", "link to node page");
$form['term_data']['linknode']['#value'] = l('
'. $link_img . " " . "Go to the taxonomy node","node/" . $nid . "/edit",$options);
$form['term_data']['linknode']['#weight'] = 57;
}
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| taxonomy_manager_node.zip | 794 bytes | jibort |