function _taxonomy_manager_form_term_data_lists in Taxonomy Manager 5
Same name and namespace in other branches
- 6.2 taxonomy_manager.admin.inc \_taxonomy_manager_form_term_data_lists()
- 6 taxonomy_manager.admin.inc \_taxonomy_manager_form_term_data_lists()
helper function for generating tables with values and delete op and field for adding
Parameters
$term term object which is going to be displayed:
$values array of values to show, e.g related terms, synonyms, parents, children:
$header_type string to display as header:
$attr attribute type to show, can be 'related', 'synonym', 'parent', 'child':
$autocomplete if true, adds autocomplete, else a textfield:
$add if true, shows add operation:
Return value
an form array
1 call to _taxonomy_manager_form_term_data_lists()
- taxonomy_manager_form_term_data in ./
taxonomy_manager.module - term data editing form
File
- ./
taxonomy_manager.module, line 777 - Taxonomy Manager
Code
function _taxonomy_manager_form_term_data_lists($term, $values, $header_type, $attr, $autocomplete = TRUE, $add = TRUE) {
$module_path = drupal_get_path('module', 'taxonomy_manager') . '/';
$rows = array();
foreach ($values as $tid => $value) {
$row = array();
if (is_object($value)) {
$name = $value->name;
$id = $value->tid;
}
else {
$name = $value;
$id = $value;
}
$row[] = array(
'data' => check_plain($name),
'class' => 'taxonomy-term-data-name',
'id' => 'term-' . $id,
);
$row[] = array(
'data' => theme("image", $module_path . "images/list-remove.png", "term-remove", NULL, array(
'class' => $attr,
)),
'class' => 'taxonomy-term-data-operations',
);
$rows[] = $row;
}
$headers = array(
t('!type', array(
'!type' => $header_type,
)),
'',
);
$form['list'] = array(
'#value' => theme('table', $headers, $rows, array(
'class' => 'taxonomy-term-data-table',
)),
);
if ($add) {
$form['add'] = array(
'#type' => 'textfield',
'#prefix' => '<div class="term-data-autocomplete-line"><div class="term-data-autocomplete">',
'#suffix' => '</div>',
'#size' => 35,
);
if ($autocomplete) {
$form['add']['#autocomplete_path'] = 'taxonomy/autocomplete/' . $term->vid;
}
$form['add_button'] = array(
'#value' => theme("image", $module_path . "images/list-add.png", "term-remove", NULL, array(
'class' => $attr,
)),
'#prefix' => '<div class="term-data-autocomplete-add">',
'#suffix' => '</div><div class="clear"></div></div>',
);
}
return $form;
}