widget documentation
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field / Container.pm
CommitLineData
e984a788 1package Reaction::UI::Widget::Field::Container;
2
3use Reaction::UI::WidgetClass;
4
5use namespace::clean -except => [ qw(meta) ];
6
7before fragment widget {
8 arg name => $_{viewport}->name;
9};
10
11implements fragment maybe_label {
12 return unless $_{viewport}->has_label;
13 arg label => $_{viewport}->label;
14 render 'label';
15};
16
17implements fragment field_list {
18 render field => over $_{viewport}->fields;
19};
20
21implements fragment field {
22 render 'viewport';
23};
24
25__PACKAGE__->meta->make_immutable;
26
271;
28
29__END__;
30
31=head1 NAME
32
f9b32c83 33Reaction::UI::Widget::Field::Container - A field containing multiple values
e984a788 34
35=head1 DESCRIPTION
36
f9b32c83 37This widget implements a field containing multiple value viewports found in
38the current viewport's C<fields> attribute.
39
e984a788 40=head1 FRAGMENTS
41
f9b32c83 42=head2 widget
43
44Sets the C<name> argument to the viewport's C<name> attribute.
45
46=head2 maybe_label
47
48Sets the C<label> argument to the viewport's C<label> attribute value and
49renders the C<label> fragment when the viewport has a label defined.
50
e984a788 51=head2 field_list
52
53Sequentially renders the C<fields> of the viewport;
54
55=head2 field
56
57Renders the C<field> viewport passed by C<field_list>
58
f9b32c83 59=head1 LAYOUT SETS
60
61=head2 base
62
63 share/skin/base/layout/field/container.tt
64
65The following layouts are provided:
66
67=over 4
68
69=item widget
70
71Renders a C<fieldset> element containing the C<maybe_label> and C<field_list>
72fragments.
73
74=item label
75
76Renders a C<legend> element for the C<fieldset> containing the C<label> argument.
77
78=item field
79
80Wraps the next C<field> fragment in a C<span> element.
81
82=back
83
e984a788 84=head1 AUTHORS
85
86See L<Reaction::Class> for authors.
87
88=head1 LICENSE
89
90See L<Reaction::Class> for the license.
91
92=cut
93