fixed hidden array viewport value_string attribute
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / Mutable / Array.pm
CommitLineData
ddccc6a2 1package Reaction::UI::ViewPort::Field::Mutable::Array;
2
3use Reaction::Class;
4
81393881 5use namespace::clean -except => [ qw(meta) ];
6extends 'Reaction::UI::ViewPort::Field::Array';
ddccc6a2 7
81393881 8with 'Reaction::UI::ViewPort::Field::Role::Mutable';
9
10around value => sub {
11 my $orig = shift;
12 my $self = shift;
13 return $orig->($self) unless @_;
14 my $value = defined $_[0] ? $_[0] : [];
15 $orig->($self, (ref $value eq 'ARRAY' ? $value : [ $value ]));
ddccc6a2 16};
81393881 17
56d5a4eb 18# value_string doesn't make sense in an Array field
19override _value_string_from_value => sub { shift->_empty_string_value };
20
21__PACKAGE__->meta->make_immutable;
ddccc6a2 22
231;
24