Refine survey list layout and backend active toggle

This commit is contained in:
Jürgen Mummert
2026-06-07 20:52:57 +02:00
parent 59514c6911
commit fb9a5b9ee6
5 changed files with 65 additions and 57 deletions
-16
View File
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Mummert\SurveyBundle\EventListener;
use Contao\Backend;
use Contao\Config;
use Contao\CoreBundle\Routing\ContentUrlGenerator;
use Contao\CoreBundle\Framework\ContaoFramework;
@@ -105,21 +104,6 @@ final class SurveyDcaListener
);
}
public function generateToggleActiveButton(array $row, ?string $href, string $label, string $title, ?string $icon, string $attributes): string
{
$isActive = '1' === (string) ($row['isActive'] ?? '');
$icon = $isActive ? 'visible.svg' : 'invisible.svg';
$title = $isActive ? 'Umfrage vorübergehend deaktivieren' : 'Umfrage wieder aktivieren';
return sprintf(
'<a href="%s" title="%s"%s>%s</a>',
htmlspecialchars(Backend::addToUrl(($href ?? '').'&amp;id='.(int) ($row['id'] ?? 0)), ENT_QUOTES),
htmlspecialchars($title, ENT_QUOTES),
$attributes,
Image::getHtml($icon, $label)
);
}
/**
* @return array<int, string>
*/