. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use Fisharebest\Webtrees\Filter; use Fisharebest\Webtrees\Tree; /** * TEXT_FROM_SOURCE := {Size=1:248} * * A verbatim copy of any description contained within the source. This indicates notes or text * that are actually contained in the source document, not the submitter's opinion about the * source. This should be, from the evidence point of view, "what the original record keeper * said" as opposed to the researcher's interpretation. The word TEXT, in this case, means from * the text which appeared in the source record including labels. */ class TextFromSource extends AbstractElement { /** * Convert a value to a canonical form. * * @param string $value * * @return string */ public function canonical(string $value): string { // Browsers use MS-DOS line endings in multi-line data. return strtr($value, ["\r\n" => "\n", "\r" => "\n"]); } /** * An edit control for this data. * * @param string $id * @param string $name * @param string $value * @param Tree $tree * * @return string */ public function edit(string $id, string $name, string $value, Tree $tree): string { return $this->editTextArea($id, $name, $value); } /** * Display the value of this type of element. * * @param string $value * @param Tree $tree * * @return string */ public function value(string $value, Tree $tree): string { return Filter::formatText($value, $tree); } }