public function csl_date::render in Bibliography Module 7
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_date::render()
- 7.2 modules/CiteProc/CSL.inc \csl_date::render()
Overrides csl_rendering_element::render
File
- modules/
CiteProc/ CSL.inc, line 1243 - CiteProc-PHP.
Class
Code
public function render($data, $mode = NULL) {
$date_parts = array();
$text = '';
if (($var = $this->variable) && isset($data->{$var})) {
if (is_array($data->{$var})) {
$date = $data->{$var};
}
else {
$date = array(
$data->{$var},
);
}
foreach ($this->elements as $element) {
$date_parts[] = $element
->render($date, $mode);
}
$text = implode($this->delimiter, $date_parts);
}
// @code
// else {
// $text = $this->citeproc->get_locale('term', 'no date');
// }
// @endcode
return $this
->format($text);
}