From 015d45ca807ddd6ba6e6a87e11ab8cda6250baad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 26 Mar 2021 19:22:31 +0100 Subject: [PATCH] MaterialComponents: checkbox_tag --- SL/Presenter/MaterialComponents.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SL/Presenter/MaterialComponents.pm b/SL/Presenter/MaterialComponents.pm index a4eacc8d3..6259fe446 100644 --- a/SL/Presenter/MaterialComponents.pm +++ b/SL/Presenter/MaterialComponents.pm @@ -285,6 +285,22 @@ sub select_tag { ); } +sub checkbox_tag { + my ($name, %attributes) = @_; + + _set_id_attribute(\%attributes, $name); + + my $label = $attributes{label} + ? html_tag('span', delete $attributes{label}) + : ''; + + my $checkbox_html = SL::Presenter::Tag::checkbox_tag($name, %attributes); + + html_tag('label', + $checkbox_html . $label, + ); +} + 1; __END__ -- 2.20.1