a65f3cbf4b68f6eaba1b0508da7ebf04cf95c599
[catagits/Reaction.git] / lib / Reaction / UI / Widget / Field / Mutable / HiddenArray.pm
1 package Reaction::UI::Widget::Field::Mutable::HiddenArray;
2
3 use Reaction::UI::WidgetClass;
4
5 #move this to a normal list and let the hidden part be decided by the template..
6 use namespace::clean -except => [ qw(meta) ];
7 extends 'Reaction::UI::Widget::Field::Mutable';
8
9 implements fragment hidden_list {
10   render hidden_field => over $_{viewport}->value;
11 };
12
13 implements fragment hidden_field {
14   # this needs to go here in order to override the field_name from
15   # Widget::Field::Mutable::Simple which defaults to value_string and does not
16   # make sense for HiddenArray
17   arg field_name => event_id 'value';
18   arg field_value => $_;
19 };
20
21 __PACKAGE__->meta->make_immutable;
22
23
24 1;
25
26 __END__;
27
28 =head1 NAME
29
30 Reaction::UI::Widget::Field::Mutable::HiddenArray
31
32 =head1 DESCRIPTION
33
34 See L<Reaction::UI::Widget::Field::Mutable>. This renders a list of values
35 as a series of hidden fields to transport them across forms.
36
37 =head1 FRAGMENTS
38
39 =head2 hidden_list
40
41 Renders C<hidden_field> over the array reference stored in the viewpoint's
42 C<value>.
43
44 =head2 hidden_field
45
46 Sets the C<field_value> argument to the current topic argument C<_>.
47
48 =head2 field
49
50 renders fragment C<item> over the values of 'value' arrayref
51
52 =head2 item
53
54 C<content> is $_{_} / $_ (current item in the 'value' array)
55
56 =head1 LAYOUT SETS
57
58 =head2 base
59
60   share/skin/base/layout/field/mutable/hidden_array.tt
61
62 Provides a C<hidden_field> layout that renders a hidden input element.
63
64 =head1 AUTHORS
65
66 See L<Reaction::Class> for authors.
67
68 =head1 LICENSE
69
70 See L<Reaction::Class> for the license.
71
72 =cut