function _taxonomy_manager_tree_get_item in Taxonomy Manager 7
Same name and namespace in other branches
- 5 taxonomy_manager.module \_taxonomy_manager_tree_get_item()
- 6.2 taxonomy_manager.module \_taxonomy_manager_tree_get_item()
- 6 taxonomy_manager.module \_taxonomy_manager_tree_get_item()
loads tree with terms (depending on various settings)
Parameters
$vid:
$parent:
$pager:
$siblings_page:
Return value
array with term elements
1 call to _taxonomy_manager_tree_get_item()
- taxonomy_manager_tree_process_elements in ./
taxonomy_manager.module - Processes the tree form element
File
- ./
taxonomy_manager.module, line 350 - Taxonomy Manager
Code
function _taxonomy_manager_tree_get_item($vid, $parent = 0, $pager = FALSE, $siblings_page = 0, $search_string = NULL, $language_code = NULL) {
$tree = array();
if (module_exists('i18n_taxonomy') && $language_code != "") {
return _taxonomy_manager_tree_get_translated_item($vid, $parent, $pager, $siblings_page, $search_string, $language_code);
}
if ($pager) {
if ($parent || $siblings_page) {
$start = ($siblings_page - 1) * variable_get('taxonomy_manager_pager_tree_page_size', TAXONOMY_MANAGER_PAGER_TREE_PAGE_SIZE_DEFAULT);
$result = db_query_range("SELECT t.* FROM {taxonomy_term_data} t INNER JOIN {taxonomy_term_hierarchy} h ON t.tid = h.tid WHERE vid = :vid AND h.parent = :parent ORDER BY t.weight, t.name", $start, variable_get('taxonomy_manager_pager_tree_page_size', 100), array(
':vid' => $vid,
':parent' => $parent,
));
}
else {
$query = db_select('taxonomy_term_data', 't')
->extend('PagerDefault');
$query
->fields('t');
$table_alias = $query
->join('taxonomy_term_hierarchy', 'h', 't.tid = h.tid AND h.parent = 0');
$query
->condition('t.vid', $vid)
->orderBy('t.weight', 'ASC')
->orderBy('t.name', 'ASC')
->limit(variable_get('taxonomy_manager_pager_tree_page_size', TAXONOMY_MANAGER_PAGER_TREE_PAGE_SIZE_DEFAULT));
if ($search_string) {
$query
->condition('name', '%' . db_like($search_string) . '%', 'LIKE');
}
$result = $query
->execute();
}
foreach ($result as $term) {
$term->depth = 0;
$tree[] = $term;
}
}
else {
$tree = taxonomy_get_tree($vid, $parent);
}
return $tree;
}