|
3 | 3 | /** |
4 | 4 | * This file is part of contao-community-alliance/dc-general. |
5 | 5 | * |
6 | | - * (c) 2013-2025 Contao Community Alliance. |
| 6 | + * (c) 2013-2026 Contao Community Alliance. |
7 | 7 | * |
8 | 8 | * For the full copyright and license information, please view the LICENSE |
9 | 9 | * file that was distributed with this source code. |
|
19 | 19 | * @author Ingolf Steinhardt <info@e-spin.de> |
20 | 20 | * @author Sven Baumann <baumann.sv@gmail.com> |
21 | 21 | * @author Richard Henkenjohann <richardhenkenjohann@googlemail.com> |
22 | | - * @copyright 2013-2025 Contao Community Alliance. |
| 22 | + * @copyright 2013-2026 Contao Community Alliance. |
23 | 23 | * @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later |
24 | 24 | * @filesource |
25 | 25 | */ |
26 | 26 |
|
27 | 27 | namespace ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView; |
28 | 28 |
|
29 | | -use Contao\Backend; |
30 | 29 | use Contao\Config; |
31 | 30 | use Contao\CoreBundle\Framework\ContaoFramework; |
32 | 31 | use Contao\Date; |
@@ -205,26 +204,22 @@ public function loadRichTextEditor($buffer, Widget $widget) |
205 | 204 | return $buffer; |
206 | 205 | } |
207 | 206 |
|
208 | | - /** @psalm-suppress InternalMethod - Class Adapter is internal, not the __call() method. Blame Contao. */ |
209 | | - $backendAdapter = $this->framework->getAdapter(Backend::class); |
210 | 207 | /** @psalm-suppress InternalMethod - Class Adapter is internal, not the __call() method. Blame Contao. */ |
211 | 208 | $templateLoader = $this->framework->getAdapter(TemplateLoader::class); |
212 | 209 |
|
213 | | - [$file, $type] = \explode('|', $rte) + ['', '']; |
214 | | - |
215 | | - $templateName = 'be_' . $file; |
| 210 | + $isAce = (0 === \strncmp($rte, 'ace', 3)); |
| 211 | + $templateName = 'be_' . $rte; |
216 | 212 | // This test if the rich text editor template exist. |
217 | 213 | $templateLoader->getPath($templateName, 'html5'); |
218 | 214 |
|
219 | 215 | $template = new ContaoBackendViewTemplate($templateName); |
220 | 216 | $template |
221 | 217 | ->set('selector', 'ctrl_' . $widget->id) |
222 | | - ->set('type', $type) |
223 | 218 | ->set('readonly', $widget->readonly); |
224 | 219 |
|
225 | | - if (0 !== \strncmp($rte, 'tiny', 4)) { |
226 | | - /** @deprecated Deprecated since Contao 4.0, to be removed in Contao 5.0 */ |
227 | | - $template->set('language', $backendAdapter->getTinyMceLanguage()); |
| 220 | + if ($isAce) { |
| 221 | + /** @psalm-suppress UndefinedMagicPropertyFetch */ |
| 222 | + $template->set('type', \strtolower((string) ($widget->highlight ?? ''))); |
228 | 223 | } |
229 | 224 |
|
230 | 225 | $buffer .= $template->parse(); |
|
0 commit comments