adds useful method removeField
This commit is contained in:
@@ -562,6 +562,14 @@ class BTBTest extends PHPUnit_Framework_TestCase {
|
|||||||
unlink($test_file);
|
unlink($test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_removeField() {
|
||||||
|
$btb = $this->createDB();
|
||||||
|
$first_entry=$btb->getEntryByKey('aKey');
|
||||||
|
$this->assertTrue($first_entry->hasField('author'));
|
||||||
|
$first_entry->removeField('author');
|
||||||
|
$this->assertFalse($first_entry->hasField('author'));
|
||||||
|
}
|
||||||
|
|
||||||
} // end class
|
} // end class
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1207,6 +1207,13 @@ class BibEntry {
|
|||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** removes a field from this bibtex entry */
|
||||||
|
function removeField($name) {
|
||||||
|
$name = strtolower($name);
|
||||||
|
unset($this->raw_fields[$name]);
|
||||||
|
unset($this->fields[$name]);
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets a field of this bib entry. */
|
/** Sets a field of this bib entry. */
|
||||||
function setField($name, $value) {
|
function setField($name, $value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user