Revision 94ca5d51
Von Bernd Bleßmann vor mehr als 3 Jahren hinzugefügt
SL/Template/Plugin/L.pm | ||
---|---|---|
83 | 83 |
sub textarea_tag { return _call_presenter('textarea_tag', @_); } |
84 | 84 |
sub date_tag { return _call_presenter('date_tag', @_); } |
85 | 85 |
sub div_tag { return _call_presenter('div_tag', @_); } |
86 |
sub radio_button_tag { return _call_presenter('radio_button_tag', @_); } |
|
86 | 87 |
|
87 | 88 |
sub _set_id_attribute { |
88 | 89 |
my ($attributes, $name, $unique) = @_; |
... | ... | |
97 | 98 |
return $self->html_tag('img', undef, %options); |
98 | 99 |
} |
99 | 100 |
|
100 |
sub radio_button_tag { |
|
101 |
my ($self, $name, %attributes) = _hashify(2, @_); |
|
102 |
|
|
103 |
$attributes{value} = 1 unless exists $attributes{value}; |
|
104 |
|
|
105 |
_set_id_attribute(\%attributes, $name, 1); |
|
106 |
my $label = delete $attributes{label}; |
|
107 |
|
|
108 |
_set_id_attribute(\%attributes, $name . '_' . $attributes{value}); |
|
109 |
|
|
110 |
if ($attributes{checked}) { |
|
111 |
$attributes{checked} = 'checked'; |
|
112 |
} else { |
|
113 |
delete $attributes{checked}; |
|
114 |
} |
|
115 |
|
|
116 |
my $code = $self->html_tag('input', undef, %attributes, name => $name, type => 'radio'); |
|
117 |
$code .= $self->html_tag('label', $label, for => $attributes{id}) if $label; |
|
118 |
|
|
119 |
return $code; |
|
120 |
} |
|
121 |
|
|
122 | 101 |
sub ul_tag { |
123 | 102 |
my ($self, $content, @slurp) = @_; |
124 | 103 |
return $self->html_tag('ul', $content, @slurp); |
... | ... | |
484 | 463 |
Creates a date input field, with an attached javascript that will open a |
485 | 464 |
calendar on click. |
486 | 465 |
|
487 |
=item C<radio_button_tag $name, %attributes> |
|
488 |
|
|
489 |
Creates a HTML 'input type=radio' tag named C<$name> with arbitrary |
|
490 |
HTML attributes from C<%attributes>. The tag's C<value> defaults to |
|
491 |
C<1>. The tag's C<id> defaults to C<name_to_id($name . "_" . $value)>. |
|
492 |
|
|
493 |
If C<%attributes> contains a key C<label> then a HTML 'label' tag is |
|
494 |
created with said C<label>. No attribute named C<label> is created in |
|
495 |
that case. |
|
496 |
|
|
497 | 466 |
=item C<javascript_tag $file1, $file2, $file3...> |
498 | 467 |
|
499 | 468 |
Creates a HTML 'E<lt>script type="text/javascript" src="..."E<gt>' |
Auch abrufbar als: Unified diff
Presenter::Tag: radio_button_tag aus Plugin/L verschoben