xref: /webtrees/app/Module/ShareUrlModule.php (revision d11be7027e34e3121be11cc025421873364403f9)
1853f2b8aSGreg Roach<?php
2853f2b8aSGreg Roach
3853f2b8aSGreg Roach/**
4853f2b8aSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6853f2b8aSGreg Roach * This program is free software: you can redistribute it and/or modify
7853f2b8aSGreg Roach * it under the terms of the GNU General Public License as published by
8853f2b8aSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9853f2b8aSGreg Roach * (at your option) any later version.
10853f2b8aSGreg Roach * This program is distributed in the hope that it will be useful,
11853f2b8aSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12853f2b8aSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13853f2b8aSGreg Roach * GNU General Public License for more details.
14853f2b8aSGreg Roach * You should have received a copy of the GNU General Public License
15853f2b8aSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16853f2b8aSGreg Roach */
17853f2b8aSGreg Roach
18853f2b8aSGreg Roachdeclare(strict_types=1);
19853f2b8aSGreg Roach
20853f2b8aSGreg Roachnamespace Fisharebest\Webtrees\Module;
21853f2b8aSGreg Roach
22853f2b8aSGreg Roachuse Fisharebest\Webtrees\GedcomRecord;
23853f2b8aSGreg Roachuse Fisharebest\Webtrees\I18N;
24853f2b8aSGreg Roach
25853f2b8aSGreg Roachuse function view;
26853f2b8aSGreg Roach
27853f2b8aSGreg Roach/**
28853f2b8aSGreg Roach * Class ShareUrlModule
29853f2b8aSGreg Roach */
30853f2b8aSGreg Roachclass ShareUrlModule extends AbstractModule implements ModuleShareInterface
31853f2b8aSGreg Roach{
32853f2b8aSGreg Roach    use ModuleShareTrait;
33853f2b8aSGreg Roach
34853f2b8aSGreg Roach    /**
35853f2b8aSGreg Roach     * How should this module be identified in the control panel, etc.?
36853f2b8aSGreg Roach     *
37853f2b8aSGreg Roach     * @return string
38853f2b8aSGreg Roach     */
39853f2b8aSGreg Roach    public function title(): string
40853f2b8aSGreg Roach    {
41853f2b8aSGreg Roach        return I18N::translate('Share the URL');
42853f2b8aSGreg Roach    }
43853f2b8aSGreg Roach
44853f2b8aSGreg Roach    /**
45853f2b8aSGreg Roach     * A sentence describing what this module does.
46853f2b8aSGreg Roach     *
47853f2b8aSGreg Roach     * @return string
48853f2b8aSGreg Roach     */
49853f2b8aSGreg Roach    public function description(): string
50853f2b8aSGreg Roach    {
51853f2b8aSGreg Roach        return I18N::translate('Copy the URL of the record to the clipboard');
52853f2b8aSGreg Roach    }
53853f2b8aSGreg Roach
54853f2b8aSGreg Roach    /**
55853f2b8aSGreg Roach     * HTML to include in the share links page.
56853f2b8aSGreg Roach     *
57853f2b8aSGreg Roach     * @param GedcomRecord $record
58853f2b8aSGreg Roach     *
59853f2b8aSGreg Roach     * @return string
60853f2b8aSGreg Roach     */
61853f2b8aSGreg Roach    public function share(GedcomRecord $record): string
62853f2b8aSGreg Roach    {
63853f2b8aSGreg Roach        return view('modules/share-url/share', ['record' => $record]);
64853f2b8aSGreg Roach    }
65853f2b8aSGreg Roach}
66