diff --git a/js/backend.js b/js/backend.js index 3ff3ed5..e3bab98 100644 --- a/js/backend.js +++ b/js/backend.js @@ -5,7 +5,6 @@ $(() => { if (typeof jsToolBar === 'function') { $('#disclaimer_text').each(function () { const tbWidgetTextDisclaimer = new jsToolBar(this); - tbWidgetTextDisclaimer.context = 'disclaimer_text'; tbWidgetTextDisclaimer.draw('xhtml'); }); } diff --git a/src/Backend.php b/src/Backend.php index 09608ce..66814ea 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Dotclear\Plugin\disclaimer; +use ArrayObject; use dcCore; use dcPage; use dcNsProcess; @@ -70,15 +71,13 @@ class Backend extends dcNsProcess }, 'adminBlogPreferencesHeaders' => function (): string { - // nullsafe PHP < 8.0 - if (is_null(dcCore::app()->auth)) { - return ''; - } - $editor = dcCore::app()->auth->getOption('editor'); + return dcPage::jsModuleLoad(My::id() . '/js/backend.js'); + }, - return - dcCore::app()->callBehavior('adminPostEditor', $editor['xhtml'], 'disclaimer', ['#disclaimer_text'], 'xhtml') . - dcPage::jsModuleLoad(My::id() . '/js/backend.js'); + 'adminPostEditorTags' => function (string $editor, string $context, ArrayObject $alt_tags, string $format): void { + if ($context == 'blog_desc') { + $alt_tags->append('#disclaimer_text'); + } }, 'adminBlogPreferencesFormV2' => function (dcSettings $blog_settings): void {