You are here

biblio.tokens.inc in Bibliography Module 6.2

File

includes/biblio.tokens.inc
View source
<?php

/**
 * @file
 *
 */

/**
 *
 *
 * @param string $type
 *   (optional)
 *
 * @return
 *
 */
function _biblio_token_list($type = 'all') {
  if ($type == 'node') {
    $tokens['node']['biblio_year'] = t("Biblio: Publication year");
    $tokens['node']['biblio_authors'] = t("Biblio: Authors");
    $tokens['node']['biblio_type_id'] = t("Biblio: Type ID (e.g.: 100)");
    $tokens['node']['biblio_type'] = t("Biblio: Type Name (e.g.: book)");
    $tokens['node']['biblio_citekey'] = t("Biblio: Cite Key often used in BibTex files");
    return $tokens;
  }
}

/**
 * Implements hook_token_values() for Organic Group specific tokens.
 */
function _biblio_token_values($type, $object = NULL) {
  switch ($type) {
    case 'node':
      if ($object->type == "biblio") {
        $type = db_result(db_query('SELECT name FROM {biblio_types} as t WHERE t.tid = %d', $object->biblio_type));

        #$title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $gid));
        $values['biblio_year'] = check_plain($object->biblio_year);
        $values['biblio_authors'] = check_plain($object->biblio_contributors[1][0]['lastname']);
        $values['biblio_type_id'] = check_plain($object->biblio_type);
        $values['biblio_type'] = check_plain($type);
        $values['biblio_citekey'] = check_plain($object->biblio_citekey);
        return $values;
      }
      break;
  }
}

Functions

Namesort descending Description
_biblio_token_list
_biblio_token_values Implements hook_token_values() for Organic Group specific tokens.