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

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

class RelatedObject is 'Reaction::UI::ViewPort::Field', which {

  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;
  };

};

1;