| 1 |
<?php |
<?php |
| 2 |
// $Id: taxonomy_browser.module,v 1.19.2.11.2.18 2008/06/16 19:09:42 nancyw Exp $ |
// $Id: taxonomy_browser.module,v 1.19.2.11.2.19 2008/06/20 04:07:50 nancyw Exp $ |
| 3 |
// Original by Moshe Weitzman (weitzmna@tejasa.com) |
// Original by Moshe Weitzman (weitzmna@tejasa.com) |
| 4 |
|
|
| 5 |
/** |
/** |
| 334 |
$voc = taxonomy_vocabulary_load($v); |
$voc = taxonomy_vocabulary_load($v); |
| 335 |
|
|
| 336 |
$voc_node_types = array(); |
$voc_node_types = array(); |
| 337 |
foreach ($voc->nodes as $key => $type) { |
if (isset($voc->nodes) && !empty($voc->nodes)) { |
| 338 |
$voc_node_types[] = $node_types[$type]; |
foreach ($voc->nodes as $key => $type) { |
| 339 |
|
$voc_node_types[] = $node_types[$type]; |
| 340 |
|
} |
| 341 |
|
} |
| 342 |
|
else { |
| 343 |
|
drupal_set_message(t('The %name vocabulary does not appear to be associated with any content types.', array('%name' => $voc->name)), 'warning'); |
| 344 |
} |
} |
| 345 |
|
|
| 346 |
$count_types = count($voc_node_types); |
$count_types = count($voc_node_types); |
| 347 |
if (count($voc_node_types) == 1) { |
if (count($voc_node_types) == 1) { |
| 348 |
$node_type_list = $voc_node_types[0]; |
$node_type_list = $voc_node_types[0]; |
| 372 |
} |
} |
| 373 |
} |
} |
| 374 |
|
|
| 375 |
$vocname = filter_xss($voc->name); |
$vocname = check_plain($voc->name); |
| 376 |
|
$description = $voc->description ? decode_entities(check_markup($voc->description)) : null; |
| 377 |
|
$description .= t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => (empty($node_type_list) ? '<em>'. t('nothing') .'</em>' : $node_type_list))); |
| 378 |
if (!empty($term_opts)) { |
if (!empty($term_opts)) { |
| 379 |
$form['taxonomy'][$v] = array( |
$form['taxonomy'][$v] = array( |
| 380 |
'#type' => $select_type, |
'#type' => $select_type, |
| 381 |
'#title' => $vocname, |
'#title' => $vocname, |
| 382 |
'#options' => $term_opts, |
'#options' => $term_opts, |
| 383 |
'#multiple' => true, |
'#multiple' => true, |
| 384 |
'#description' => $voc->description |
'#description' => $description, |
|
.' '. t('"!name" is used for: !types.', array('!name' => '<strong>'. $vocname .'</strong>', '!types' => $node_type_list)), |
|
| 385 |
'#size' => min(10, count($term_opts)), |
'#size' => min(10, count($term_opts)), |
| 386 |
'#prefix' => '<div class="taxonomy_browser_'. $select_type .'">', |
'#prefix' => '<div class="taxonomy_browser_'. $select_type .'">', |
| 387 |
'#suffix' => '</div>', |
'#suffix' => '</div>', |