You are here

biblio_handler_citation.inc in Bibliography Module 6

File

views/biblio_handler_citation.inc
View source
<?php

class biblio_handler_citation extends views_handler_field {
  function init(&$view, $options) {
    parent::init($view, $options);
    $this->additional_fields['nid'] = array(
      'table' => 'node',
      'field' => 'nid',
    );
  }
  function query() {
    $this
      ->add_additional_fields();
  }
  function option_definition() {
    $options = parent::option_definition();
    $options['style_name'] = array(
      'default' => biblio_get_style(),
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    module_load_include('inc', 'biblio', 'biblio.admin');
    $form['style_name'] = array(
      '#type' => 'radios',
      '#title' => t('Style'),
      '#default_value' => $this->options['style_name'],
      '#options' => _biblio_admin_get_styles(),
      '#description' => t('Define the layout of author lists.'),
    );
  }
  function render($values) {
    $node = node_load($values->{$this->aliases['nid']});
    $base = variable_get('biblio_base', 'biblio');
    $inline = false;
    if ($node->type == 'biblio') {
      return theme('biblio_entry', $node, $base, $this->options['style_name'], $inline);
    }
  }

}

Classes