Files
wk-sync-bundle/src/Widget/Backend/ExplanationWidget.php
T
Jürgen MummertandClaude Fable 5.1 fdaff1b1d1 Explain the notification conditions in the settings form
The explanation texts existed but used the "explanation" input type,
which Contao only knows in the front end form generator, so the backend
rendered nothing and editors saw twelve unlabelled selects. A small
backend explanation widget now shows how a notification is chosen and
the condition matrix, each select carries its condition as label, the
single-day and multi-day variants sit side by side, and a notice with a
link to the Notification Center appears while no notification of the
type "W&K booking" exists.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 17:36:18 +02:00

33 lines
1009 B
PHP

<?php
declare(strict_types=1);
namespace Mummert\ContaoWkSyncBundle\Widget\Backend;
use Contao\Widget;
/**
* Erklärungstext im Backend-Formular (Contao kennt „explanation“ nur im Frontend-Formulargenerator).
*
* Der Text kommt aus eval.text oder, wenn leer, aus $GLOBALS['TL_LANG'][Tabelle][Feld]; eval.boxClass
* bestimmt die Box (Standard tl_info, alternativ z. B. tl_error). Das Feld wird nicht gespeichert.
*/
class ExplanationWidget extends Widget
{
protected $blnSubmitInput = false;
protected $strTemplate = 'be_widget';
public function generate(): string
{
$text = (string) ($this->arrConfiguration['text'] ?? '');
if ('' === $text) {
$lang = $GLOBALS['TL_LANG'][$this->strTable][$this->strField] ?? '';
$text = (string) (\is_array($lang) ? ($lang[0] ?? '') : $lang);
}
return \sprintf('<div class="%s wk-sync-explanation">%s</div>', (string) ($this->arrConfiguration['boxClass'] ?? 'tl_info'), $text);
}
}