public function BibtexEncoder::encode in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php \Drupal\bibcite_bibtex\Encoder\BibtexEncoder::encode()
File
- modules/
bibcite_bibtex/ src/ Encoder/ BibtexEncoder.php, line 128
Class
- BibtexEncoder
- BibTeX format encoder.
Namespace
Drupal\bibcite_bibtex\EncoderCode
public function encode($data, $format, array $context = []) {
if (isset($data['type'])) {
$data = [
$data,
];
}
$data = array_map(function ($raw) {
return $this
->buildEntry($raw);
}, $data);
return implode("\n", $data);
}