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