function Field::formatted in Bibliography Module 6
Same name and namespace in other branches
- 6.2 modules/marcParse/php-marc.php \Field::formatted()
- 7 modules/marcParse/php-marc.php \Field::formatted()
- 7.2 modules/marcParse/php-marc.php \Field::formatted()
* Return Field formatted * * Return Field as string, formatted in a similar fashion to the * MARC::Record formatted() functio in Perl *
Return value
string Formatted output of Field
File
- marcParse/
php-marc.php, line 959
Class
- Field
- Field Class Create a MARC Field object
Code
function formatted() {
// Variables
$lines = array();
// Process
if ($this->is_control) {
return sprintf("%3s %s", $this->tagno, $this->data);
}
else {
$pre = sprintf("%3s %1s%1s", $this->tagno, $this->ind1, $this->ind2);
}
// Process subfields
foreach ($this->subfields as $subfield => $value) {
$lines[] = sprintf("%6s _%1s%s", $pre, $subfield, $value);
$pre = "";
}
return join("\n", $lines);
}