From: Sven Schöling Date: Fri, 12 Mar 2021 12:50:57 +0000 (+0100) Subject: Presenter: html_tag unterstützt jetzt class => [...] Syntax X-Git-Tag: kivitendo-mebil_0.1-0~9^2~109 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e6aeed0397ec4491781676b343bb75715136c123;p=kivitendo-erp.git Presenter: html_tag unterstützt jetzt class => [...] Syntax --- diff --git a/SL/Presenter/Tag.pm b/SL/Presenter/Tag.pm index c4b9b7f78..032b179b4 100644 --- a/SL/Presenter/Tag.pm +++ b/SL/Presenter/Tag.pm @@ -46,6 +46,15 @@ sub _J { return $string; } +sub join_values { + my ($name, $value) = @_; + my $spacer = $name eq 'class' ? ' ' : ''; # join classes with spaces, everything else as is + + ref $value && 'ARRAY' eq ref $value + ? join $spacer, map { join_values($name, $_) } @$value + : $value +} + sub stringify_attributes { my (%params) = @_; @@ -54,6 +63,7 @@ sub stringify_attributes { next unless $name; next if $_valueless_attributes{$name} && !$value; $value = '' if !defined($value); + $value = join_values($name, $value) if ref $value && 'ARRAY' eq ref $value; push @result, $_valueless_attributes{$name} ? escape($name) : escape($name) . '="' . escape($value) . '"'; }