| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_browser.module,v 1.19.2.28 2008/06/20 04:08:03 nancyw Exp $ |
// $Id: taxonomy_browser.module,v 1.19.2.29 2008/06/26 16:30:54 nancyw Exp $ |
| 3 |
// Original by Moshe Weitzman (weitzmna@tejasa.com) |
// Original by Moshe Weitzman (weitzmna@tejasa.com) |
| 4 |
|
|
| 5 |
/** |
/** |
| 342 |
$voc = taxonomy_get_vocabulary($v); |
$voc = taxonomy_get_vocabulary($v); |
| 343 |
|
|
| 344 |
$voc_node_types = array(); |
$voc_node_types = array(); |
| 345 |
foreach ($voc->nodes as $key => $type) { |
if (isset($voc->nodes) && !empty($voc->nodes[0])) { |
| 346 |
$voc_node_types[] = $node_types[$type]; |
foreach ($voc->nodes as $key => $type) { |
| 347 |
} |
$voc_node_types[] = $node_types[$type]; |
| 348 |
$count_types = count($voc_node_types); |
} |
|
if (count($voc_node_types) == 1) { |
|
|
$node_type_list = $voc_node_types[0]; |
|
| 349 |
} |
} |
| 350 |
else { |
else { |
| 351 |
$node_type_list = implode(', ', $voc_node_types); |
drupal_set_message(t('The %name vocabulary does not appear to be associated with any content types.', array('%name' => $voc->name)), 'error'); |
| 352 |
} |
} |
| 353 |
|
|
| 354 |
|
$count_types = count($voc_node_types); |
| 355 |
|
$node_type_list = implode(', ', $voc_node_types); |
| 356 |
|
|
| 357 |
$tree = taxonomy_get_tree($v); |
$tree = taxonomy_get_tree($v); |
| 358 |
$term_opts = array(); |
$term_opts = array(); |
| 359 |
|
|
| 376 |
} |
} |
| 377 |
} |
} |
| 378 |
|
|
| 379 |
$vocname = filter_xss($voc->name); |
$vocname = check_plain($voc->name); |
| 380 |
|
$description = $voc->description ? decode_entities(check_markup($voc->description)) : null; |
| 381 |
|
$description .= t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => (empty($node_type_list) ? '<em>'. t('nothing') .'</em>' : $node_type_list))); |
| 382 |
if (!empty($term_opts)) { |
if (!empty($term_opts)) { |
| 383 |
$form['taxonomy'][$v] = array( |
$form['taxonomy'][$v] = array( |
| 384 |
'#type' => $select_type, |
'#type' => $select_type, |
| 385 |
'#title' => $vocname, |
'#title' => $vocname, |
| 386 |
'#options' => $term_opts, |
'#options' => $term_opts, |
| 387 |
'#multiple' => true, |
'#multiple' => true, |
| 388 |
'#description' => $voc->description |
'#description' => $description, |
|
.' '. t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => $node_type_list)), |
|
| 389 |
'#size' => min(10, count($term_opts)), |
'#size' => min(10, count($term_opts)), |
| 390 |
'#prefix' => '<div class="taxonomy_browser_'. $select_type .'">', |
'#prefix' => '<div class="taxonomy_browser_'. $select_type .'">', |
| 391 |
'#suffix' => '</div>', |
'#suffix' => '</div>', |
| 395 |
++$i; |
++$i; |
| 396 |
} |
} |
| 397 |
} |
} |
| 398 |
|
|
| 399 |
$form['submit'] = array( |
$form['submit'] = array( |
| 400 |
'#type' => 'submit', |
'#type' => 'submit', |
| 401 |
'#value' => t('Search'), |
'#value' => t('Search'), |
| 402 |
'#submit' => TRUE, |
'#submit' => TRUE, |
| 403 |
); |
); |
| 404 |
|
|
| 405 |
return $form; |
return $form; |
| 406 |
} |
} |
| 407 |
|
|