public function Field::formatted in Bibliography Module 7
Same name and namespace in other branches
- 6.2 modules/marcParse/php-marc.php \Field::formatted()
- 6 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
- modules/
marcParse/ php-marc.php, line 1055 - @package PHP-MARC
Class
- Field
- Field Class Create a MARC Field object.
Code
public 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);
}