. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use Fisharebest\Webtrees\Tree; use function e; use function rawurlencode; use function strtoupper; /** * A custom field used in _LOC records */ class GovIdentifier extends AbstractElement { protected const EXTERNAL_URL = 'https://gov.genealogy.net/item/show/'; protected const MAXIMUM_LENGTH = 12; /** * Display the value of this type of element. * * @param string $value * @param Tree $tree * * @return string */ public function value(string $value, Tree $tree): string { $canonical = $this->canonical($value); $url = static::EXTERNAL_URL . rawurlencode($canonical); return '' . e($canonical) . ''; } }