biblio_handler_field_biblio_type.inc in Bibliography Module 7.2
File
views/biblio_handler_field_biblio_type.inc
View source
<?php
class biblio_handler_field_biblio_type extends views_handler_field {
function init(&$view, $options) {
parent::init($view, $options);
if ($view->base_table == 'node_revision') {
$this->additional_fields['vid'] = array(
'table' => 'node_revision',
'field' => 'vid',
);
}
else {
$this->additional_fields['vid'] = array(
'table' => 'node',
'field' => 'vid',
);
}
}
function pre_render($values) {
$this->field_alias = $this->aliases['vid'];
$vids = array();
foreach ($values as $result) {
if (!empty($result->{$this->aliases['vid']})) {
$vids[] = $result->{$this->aliases['vid']};
}
}
if ($vids) {
$result = db_query("SELECT name, tid\n FROM {biblio_types} t\n WHERE IN (:vids)", array(
':vids' => implode(', ', $vids),
));
foreach ($result as $term) {
$this->items[$term->node_vid][$term->kid] = check_plain($term->word);
}
}
}
}