18c2e8227SGreg Roach<?php 23976b470SGreg Roach 38c2e8227SGreg Roach/** 48c2e8227SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 68c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 78c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 88c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 98c2e8227SGreg Roach * (at your option) any later version. 108c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 118c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 128c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 138c2e8227SGreg Roach * GNU General Public License for more details. 148c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 168c2e8227SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2076692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 2176692c8bSGreg Roach 220e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 238c2e8227SGreg Roach 248c2e8227SGreg Roach/** 258c2e8227SGreg Roach * Class CkeditorModule 268c2e8227SGreg Roach */ 27abafa13cSGreg Roachclass CkeditorModule extends AbstractModule implements ModuleExternalUrlInterface, ModuleGlobalInterface 28c1010edaSGreg Roach{ 2943b1a91cSGreg Roach use ModuleExternalUrlTrait; 30abafa13cSGreg Roach use ModuleGlobalTrait; 3143b1a91cSGreg Roach 3249a243cbSGreg Roach // Location of our installation of CK editor. 33b43e8d2bSGreg Roach public const CKEDITOR_PATH = 'ckeditor-4.15.1-custom/'; 3449a243cbSGreg Roach 35961ec755SGreg Roach /** 360cfd6963SGreg Roach * How should this module be identified in the control panel, etc.? 37961ec755SGreg Roach * 38961ec755SGreg Roach * @return string 39961ec755SGreg Roach */ 4049a243cbSGreg Roach public function title(): string 41c1010edaSGreg Roach { 42ad3143ccSGreg Roach /* I18N: Name of a module. CKEditor is a trademark. Do not translate it? https://ckeditor.com */ 43bbb76c12SGreg Roach return I18N::translate('CKEditor™'); 448c2e8227SGreg Roach } 458c2e8227SGreg Roach 4649a243cbSGreg Roach public function description(): string 47c1010edaSGreg Roach { 48bbb76c12SGreg Roach /* I18N: Description of the “CKEditor” module. WYSIWYG = “what you see is what you get” */ 49bbb76c12SGreg Roach return I18N::translate('Allow other modules to edit text using a “WYSIWYG” editor, instead of using HTML codes.'); 508c2e8227SGreg Roach } 5143b1a91cSGreg Roach 5243b1a91cSGreg Roach /** 5343b1a91cSGreg Roach * Home page for the service. 5443b1a91cSGreg Roach * 5543b1a91cSGreg Roach * @return string 5643b1a91cSGreg Roach */ 5743b1a91cSGreg Roach public function externalUrl(): string 5843b1a91cSGreg Roach { 5943b1a91cSGreg Roach return 'https://ckeditor.com'; 6043b1a91cSGreg Roach } 61abafa13cSGreg Roach 62abafa13cSGreg Roach /** 63abafa13cSGreg Roach * Raw content, to be added at the end of the <body> element. 64abafa13cSGreg Roach * Typically, this will be <script> elements. 65abafa13cSGreg Roach * 66abafa13cSGreg Roach * @return string 67abafa13cSGreg Roach */ 68abafa13cSGreg Roach public function bodyContent(): string 69abafa13cSGreg Roach { 70abafa13cSGreg Roach return view('modules/ckeditor/ckeditor-js', [ 713cfcc809SGreg Roach 'ckeditor_path' => asset(self::CKEDITOR_PATH), 7265cf5706SGreg Roach 'language' => I18N::locale()->language()->code(), 73abafa13cSGreg Roach ]); 74abafa13cSGreg Roach } 758c2e8227SGreg Roach} 76