|
Tripal
|
Public Member Functions | |
| __construct (TripalTokenParser $token_parser) | |
| generateCitation (string $format, array $values) | |
| getDefaultCitationTemplate (string $pub_type) | |
Protected Attributes | |
| $token_parser = NULL | |
Generates citations for publications.
The citation manager class is used to generate citations for publications of various types. The primary function is generateCitation(), and input consists of two parts, a citation template containing various tokens in a particular order with appropriate punctuation, and an associative array of key => value pairs that will be used to replace the tokens in the template.
This class can also provide default templates for several types of publications. See getDefaultCitationTemplate() for the types of publications supported.
| Drupal\tripal\Services\TripalCitationManager::__construct | ( | TripalTokenParser | $token_parser | ) |
TripalCitationManager constructor.
Drupal\tripal\Services\TripalTokenParser The token parser service.
| Drupal\tripal\Services\TripalCitationManager::generateCitation | ( | string | $format, |
| array | $values | ||
| ) |
Generate citation
| string | $format | A token string defining fields used to generate the citation. Tokens are text enclosed in square brackets, e.g. "[Title]" Tokens may be "doubled" inside another set of square brackets to indicate a prefix or suffix that is only added if the token has a value. For example, a journal may not have issue numbers. Thus, for "[ [Volume]][([Issue])][:[Pages].]", if there is no issue number, then the parentheses will not be included. |
| array | $values | An associative array defining the publication properties used to replace the tokens. The keys are the case-sensitive name of the token and the value is the value of that property. |
| Drupal\tripal\Services\TripalCitationManager::getDefaultCitationTemplate | ( | string | $pub_type | ) |
Provides a default format string based on publication type.
To use, call this method with the publication type and then pass in the result as the format string for generateCitation().
| string | $pub_type | The publication type. This is the name, not the term accession. Supported types include:
|
|
protected |
The Tripal Token Parser service.