added localization to core widgets
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field.pm
CommitLineData
8f19d042 1package Reaction::UI::Widget::Field;
2
3use Reaction::UI::WidgetClass;
4
bae75bee 5use namespace::clean -except => [ qw(meta) ];
8f19d042 6
bae75bee 7
8before fragment widget {
9 if ($_{viewport}->can('value_string')) {
10 arg 'field_value' => $_{viewport}->value_string;
11 } else {
12 arg 'field_value' => ''; #$_{viewport}->value;
13 }
14};
15
16implements fragment label_fragment {
17 if (my $label = $_{viewport}->label) {
d219104c 18 arg label => localized $label;
bae75bee 19 render 'label';
20 }
8f19d042 21};
22
bae75bee 23__PACKAGE__->meta->make_immutable;
24
25
8f19d042 261;
27
6ab43711 28__END__;
29
5a1a893e 30=head1 NAME
31
32Reaction::UI::Widget::Field
33
34=head1 DESCRIPTION
35
5a1a893e 36=head1 FRAGMENTS
37
38=head2 widget
39
40Additional variables available in topic hash: "viewport", "id", "name".
41
42Renders "label","field" and "message"
43
44=head2 field
45
46 C<content> will contain the value, if any, of the field.
47
48=head2 label
49
50 C<content> will contain the label, if any, of the field.
51
52=head2 message
53
54 C<content> will contain the message, if any, of the field.
55
56=head1 AUTHORS
57
58See L<Reaction::Class> for authors.
59
60=head1 LICENSE
61
62See L<Reaction::Class> for the license.
63
64=cut