aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort/Field/RelatedObject.pm
blob: ec5c883bea302998392a119e92b95f09e9c2c8eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Reaction::UI::ViewPort::Field::RelatedObject;

use Reaction::Class;
use Scalar::Util 'blessed';

use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort::Field';



has value_map_method => (
  isa => 'Str', is => 'ro', required => 1, default => sub { 'display_name' },
);

around _value_string_from_value => sub {
  my $orig = shift;
  my $self = shift;
  my $meth = $self->value_map_method;
  return $self->$orig(@_)->$meth;
};

__PACKAGE__->meta->make_immutable;


1;