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