Skip to content

Commit 67a2334

Browse files
committed
Fix ACE editor support
1 parent ad9087e commit 67a2334

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/Contao/View/Contao2BackendView/ContaoWidgetManager.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of contao-community-alliance/dc-general.
55
*
6-
* (c) 2013-2025 Contao Community Alliance.
6+
* (c) 2013-2026 Contao Community Alliance.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -19,14 +19,13 @@
1919
* @author Ingolf Steinhardt <info@e-spin.de>
2020
* @author Sven Baumann <baumann.sv@gmail.com>
2121
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
22-
* @copyright 2013-2025 Contao Community Alliance.
22+
* @copyright 2013-2026 Contao Community Alliance.
2323
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
2424
* @filesource
2525
*/
2626

2727
namespace ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView;
2828

29-
use Contao\Backend;
3029
use Contao\Config;
3130
use Contao\CoreBundle\Framework\ContaoFramework;
3231
use Contao\Date;
@@ -205,26 +204,22 @@ public function loadRichTextEditor($buffer, Widget $widget)
205204
return $buffer;
206205
}
207206

208-
/** @psalm-suppress InternalMethod - Class Adapter is internal, not the __call() method. Blame Contao. */
209-
$backendAdapter = $this->framework->getAdapter(Backend::class);
210207
/** @psalm-suppress InternalMethod - Class Adapter is internal, not the __call() method. Blame Contao. */
211208
$templateLoader = $this->framework->getAdapter(TemplateLoader::class);
212209

213-
[$file, $type] = \explode('|', $rte) + ['', ''];
214-
215-
$templateName = 'be_' . $file;
210+
$isAce = (0 === \strncmp($rte, 'ace', 3));
211+
$templateName = 'be_' . $rte;
216212
// This test if the rich text editor template exist.
217213
$templateLoader->getPath($templateName, 'html5');
218214

219215
$template = new ContaoBackendViewTemplate($templateName);
220216
$template
221217
->set('selector', 'ctrl_' . $widget->id)
222-
->set('type', $type)
223218
->set('readonly', $widget->readonly);
224219

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 ?? '')));
228223
}
229224

230225
$buffer .= $template->parse();

0 commit comments

Comments
 (0)