public function CiteprocPhp::render in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/BibCiteProcessor/CiteprocPhp.php \Drupal\bibcite\Plugin\BibCiteProcessor\CiteprocPhp::render()
Render citation string from CSL values array.
Parameters
array|\stdClass $data: CSL values array or object.
string $csl: Citation style (CSL) content.
string $lang: Citation language.
Return value
string Rendered citation.
Overrides BibCiteProcessorInterface::render
File
- src/
Plugin/ BibCiteProcessor/ CiteprocPhp.php, line 60
Class
- CiteprocPhp
- Defines a style provider based on citeproc-php library.
Namespace
Drupal\bibcite\Plugin\BibCiteProcessorCode
public function render($data, $csl, $lang) {
$cite_proc = new CiteProc($csl, $lang);
if (!$data instanceof \stdClass) {
$data = json_decode(json_encode($data));
}
return $cite_proc
->render($data);
}