function library_get_table_row in Library 6
Same name and namespace in other branches
- 5.2 library.module \library_get_table_row()
- 6.2 library.module \library_get_table_row()
- 7 library.module \library_get_table_row()
2 calls to library_get_table_row()
- library_display_items in ./
library.pages.inc - library_search in ./
library.module - Implementation of hook_search()
File
- ./
library.module, line 1365
Code
function library_get_table_row($node, $var) {
$row = array();
$rows = array();
if (!empty($var['fields'])) {
content_view($node);
}
$row[] = l($node->title, 'node/' . $node->nid);
if ($var['display_categories']) {
$categories = array();
foreach (variable_get('library_taxonomy_display', array()) as $key => $vocab) {
if ($vocab) {
$terms = taxonomy_node_get_terms_by_vocabulary($node, $key);
$cat_term = array();
foreach ($terms as $term) {
$cat_term[] = $term->name;
}
$cat_term = array_map('strtolower', $cat_term);
array_multisort($cat_term, SORT_ASC, $terms);
foreach ($terms as $term) {
$categories[] = l($term->name, 'taxonomy/term/' . $term->tid);
}
}
}
$row[] = implode(" | ", $categories);
}
if (!empty($var['fields'])) {
foreach ($var['fields'] as $name => $field) {
$return = '';
if (isset($node->content[$field['field_name']])) {
$return = drupal_render($node->content[$field['field_name']]);
}
$row[] = $return;
}
}
if ($var['display_quantity']) {
$row[] = library_get_quantity($node);
}
//Replace with a function to find out if there is one available item
$item = library_get_status_item($node);
if ($item && $var['display_status']) {
$row[]['data'] = library_get_status_text($item);
}
$rows[] = $row;
return $rows;
}