. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use Fisharebest\Webtrees\Tree; use function e; /** * Events which can be linked to content at another website. */ class AbstractExternalLink extends AbstractElement { protected const EXTERNAL_URL = 'https://www.example.com/{ID}'; /** * 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 = strtr(static::EXTERNAL_URL, ['{ID}' => rawurlencode($canonical)]); return '' . e($canonical) . ''; } }