Revision 927ead50
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/Template/Plugin/L.pm | ||
---|---|---|
203 | 203 |
|
204 | 204 |
my $value_title_sub = $options{value_title_sub}; |
205 | 205 |
|
206 |
my %selected = map { ( $_ => 1 ) } @{ ref($options{default}) eq 'ARRAY' ? $options{default} : $options{default} ? [ $options{default} ] : [] }; |
|
207 |
|
|
206 | 208 |
my $access = sub { |
207 | 209 |
my ($element, $index, $key, $sub) = @_; |
208 | 210 |
my $ref = ref $element; |
... | ... | |
225 | 227 |
my $code = ''; |
226 | 228 |
foreach my $result (@elements) { |
227 | 229 |
my %attributes = ( value => $result->[0] ); |
228 |
$attributes{selected} = 'selected' if $options{default} && ($options{default} eq ($result->[0] || ''));
|
|
230 |
$attributes{selected} = 'selected' if $selected{ $result->[0] || '' };
|
|
229 | 231 |
|
230 | 232 |
$code .= $self->html_tag('option', _H($result->[1]), %attributes); |
231 | 233 |
} |
... | ... | |
585 | 587 |
this element can be set with the option C<empty_title> and defaults to |
586 | 588 |
an empty string. |
587 | 589 |
|
590 |
The option C<default> can be either a scalar or an array reference |
|
591 |
containing the values of the options which should be set to be |
|
592 |
selected. |
|
593 |
|
|
588 | 594 |
=item C<tab, description, target, %PARAMS> |
589 | 595 |
|
590 | 596 |
Creates a tab for C<tabbed>. The description will be used as displayed name. |
Auch abrufbar als: Unified diff
options_for_select: Unterstützung für multiple selected-values