function _taxonomy_manager_form_term_data_lists in Taxonomy Manager 6
Same name and namespace in other branches
- 5 taxonomy_manager.module \_taxonomy_manager_form_term_data_lists()
- 6.2 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.admin.inc - term data editing form
File
- ./
taxonomy_manager.admin.inc, line 703
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();
$form['#theme'] = 'taxonomy_manager_term_data_extra';
$form['data'] = array();
foreach ($values as $tid => $value) {
if (is_object($value)) {
$name = $value->name;
$id = $value->tid;
$vid = $value->vid;
}
else {
$name = $value;
$id = $value;
}
$form['data'][$id][] = array(
'#value' => isset($vid) && $vid > 0 ? l($name, 'admin/content/taxonomy_manager/termdata/' . $vid . '/' . $id) : check_plain($name),
'#row-class' => 'taxonomy-term-data-name',
'#row-id' => 'term-' . $id,
);
$form['data'][$id][] = array(
'#value' => theme("image", $module_path . "images/list-remove.png", "term-remove", NULL, array(
'class' => $attr,
)),
'#row-class' => 'taxonomy-term-data-operations',
);
}
$form['headers'][] = array(
'#value' => $header_type,
);
$form['headers'][] = array(
'#value' => '',
);
$form['op'] = array();
if ($add) {
$form['op']['add'] = array(
'#type' => 'textfield',
'#prefix' => '<div class="term-data-autocomplete">',
'#suffix' => '</div>',
'#size' => 35,
);
if ($autocomplete) {
$form['op']['add']['#autocomplete_path'] = 'taxonomy_manager/autocomplete/' . $term->vid;
}
$form['op']['add_button'] = array(
'#value' => theme("image", $module_path . "images/list-add.png", "add", NULL, array(
'class' => $attr,
)),
'#prefix' => '<div class="term-data-autocomplete-add">',
'#suffix' => '</div>',
);
}
return $form;
}