18c2e8227SGreg Roach<?php 23976b470SGreg Roach 38c2e8227SGreg Roach/** 48c2e8227SGreg Roach * webtrees: online genealogy 5*b43e8d2bSGreg Roach * Copyright (C) 2021 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 158c2e8227SGreg Roach * along with this program. If not, see <http://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. 33*b43e8d2bSGreg 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 { 42bbb76c12SGreg Roach /* I18N: Name of a module. CKEditor is a trademark. Do not translate it? http://ckeditor.com */ 43bbb76c12SGreg Roach return I18N::translate('CKEditor™'); 448c2e8227SGreg Roach } 458c2e8227SGreg Roach 46961ec755SGreg Roach /** 47961ec755SGreg Roach * A sentence describing what this module does. 48961ec755SGreg Roach * 49961ec755SGreg Roach * @return string 50961ec755SGreg Roach */ 5149a243cbSGreg Roach public function description(): string 52c1010edaSGreg Roach { 53bbb76c12SGreg Roach /* I18N: Description of the “CKEditor” module. WYSIWYG = “what you see is what you get” */ 54bbb76c12SGreg Roach return I18N::translate('Allow other modules to edit text using a “WYSIWYG” editor, instead of using HTML codes.'); 558c2e8227SGreg Roach } 5643b1a91cSGreg Roach 5743b1a91cSGreg Roach /** 5843b1a91cSGreg Roach * Home page for the service. 5943b1a91cSGreg Roach * 6043b1a91cSGreg Roach * @return string 6143b1a91cSGreg Roach */ 6243b1a91cSGreg Roach public function externalUrl(): string 6343b1a91cSGreg Roach { 6443b1a91cSGreg Roach return 'https://ckeditor.com'; 6543b1a91cSGreg Roach } 66abafa13cSGreg Roach 67abafa13cSGreg Roach /** 68abafa13cSGreg Roach * Raw content, to be added at the end of the <body> element. 69abafa13cSGreg Roach * Typically, this will be <script> elements. 70abafa13cSGreg Roach * 71abafa13cSGreg Roach * @return string 72abafa13cSGreg Roach */ 73abafa13cSGreg Roach public function bodyContent(): string 74abafa13cSGreg Roach { 75abafa13cSGreg Roach return view('modules/ckeditor/ckeditor-js', [ 763cfcc809SGreg Roach 'ckeditor_path' => asset(self::CKEDITOR_PATH), 7765cf5706SGreg Roach 'language' => I18N::locale()->language()->code(), 78abafa13cSGreg Roach ]); 79abafa13cSGreg Roach } 808c2e8227SGreg Roach} 81