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