class csl_text in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_text
- 7 modules/CiteProc/CSL.inc \csl_text
Hierarchy
- class \csl_collection
- class \csl_element
- class \csl_rendering_element
- class \csl_format
- class \csl_text
- class \csl_format
- class \csl_rendering_element
- class \csl_element
Expanded class hierarchy of csl_text
File
- modules/
CiteProc/ CSL.inc, line 1080
View source
class csl_text extends csl_format {
public $source;
protected $var;
function init($dom_node, $citeproc) {
foreach (array(
'variable',
'macro',
'term',
'value',
) as $attr) {
if ($dom_node
->hasAttribute($attr)) {
$this->source = $attr;
if ($this->source == 'macro') {
$this->var = str_replace(' ', '_', $dom_node
->getAttribute($attr));
}
else {
$this->var = $dom_node
->getAttribute($attr);
}
}
}
}
function init_formatting() {
if ($this->variable == 'title') {
$this->span_class = 'biblio-title';
}
parent::init_formatting();
}
function render($data = NULL, $mode = NULL) {
$text = '';
switch ($this->source) {
case 'variable':
if (!isset($data->{$this->variable}) || empty($data->{$this->variable})) {
return;
}
if ($this->variable == 'biblio_url') {
$text = l($data->{$this->variable}, $data->{$this->variable});
}
else {
$text = $data->{$this->variable};
//$this->data[$this->var]; // include the contents of a variable
}
break;
case 'macro':
$macro = $this->var;
$text = $this->citeproc
->render_macro($macro, $data, $mode);
//trigger the macro process
break;
case 'term':
$form = ($form = $this->form) ? $form : '';
$text = $this->citeproc
->get_locale('term', $this->var, $form);
break;
case 'value':
$text = $this->var;
//$this->var; // dump the text verbatim
break;
}
if (empty($text)) {
return;
}
$text = $this
->format($text);
if ($this->variable == 'title') {
$url = biblio_get_title_url_info($data);
$text = l($text, $url['link'], $url['options']);
}
return $text;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
csl_collection:: |
protected | property | ||
csl_collection:: |
function | |||
csl_element:: |
protected | property | ||
csl_element:: |
protected | property | ||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_element:: |
function | |||
csl_format:: |
protected | property | 1 | |
csl_format:: |
protected | property | ||
csl_format:: |
function |
Overrides csl_collection:: |
1 | |
csl_format:: |
function |
Overrides csl_element:: |
2 | |
csl_text:: |
public | property | ||
csl_text:: |
protected | property | ||
csl_text:: |
function |
Overrides csl_element:: |
||
csl_text:: |
function |
Overrides csl_format:: |
||
csl_text:: |
function |
Overrides csl_rendering_element:: |