Commit | Line | Data |
7adfd53f |
1 | package Reaction::UI::ViewPort::Field::HiddenArray; |
2 | |
3 | use Reaction::Class; |
4 | |
5 | class HiddenArray is 'Reaction::UI::ViewPort::Field', which { |
6 | |
7 | has '+value' => (isa => 'ArrayRef'); |
1734a92a |
8 | |
7adfd53f |
9 | around value => sub { |
10 | my $orig = shift; |
11 | my $self = shift; |
12 | if (@_) { |
1734a92a |
13 | #this hsould be done with coercions |
7adfd53f |
14 | $orig->($self, (ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ])); |
15 | $self->sync_to_action; |
16 | } else { |
17 | $orig->($self); |
18 | } |
19 | }; |
20 | |
1734a92a |
21 | implements _empty_value => as { [] }; |
7adfd53f |
22 | }; |
23 | |
1734a92a |
24 | 1; |
7adfd53f |
25 | |
26 | =head1 NAME |
27 | |
28 | Reaction::UI::ViewPort::Field::HiddenArray |
29 | |
30 | =head1 DESCRIPTION |
31 | |
32 | =head1 SEE ALSO |
33 | |
34 | =head2 L<Reaction::UI::ViewPort::Field> |
35 | |
36 | =head1 AUTHORS |
37 | |
38 | See L<Reaction::Class> for authors. |
39 | |
40 | =head1 LICENSE |
41 | |
42 | See L<Reaction::Class> for the license. |
43 | |
44 | =cut |