feat: add function addKeyword

This commit is contained in:
Martin Monperrus
2024-10-04 10:58:04 +02:00
parent 4ed89551b5
commit aa886ffb39
2 changed files with 30 additions and 1 deletions
+6 -1
View File
@@ -1738,7 +1738,12 @@ class BibEntry {
function getKeywords() {
return preg_split('/[,;\\/]/', $this->getField("keywords"));
}
function addKeyword($new_keyword) {
$r = $this->getField('keywords');
if ($r == null || strlen($r) == 0) return $this->setField('keywords', $new_keyword);
return $this->setField('keywords', $r.";".$new_keyword);
}
/** Returns the value of the given field? */
function getField($name) {
// 2010-06-07: profiling showed that this is very costly