7 |
extends 'Frey'; |
extends 'Frey'; |
8 |
with 'Frey::Web::Field'; |
with 'Frey::Web::Field'; |
9 |
with 'Frey::Web::Layout'; |
with 'Frey::Web::Layout'; |
10 |
|
with 'Frey::Storage'; |
11 |
#with 'BonusTypes'; |
#with 'BonusTypes'; |
12 |
|
|
13 |
use Moose::Util::TypeConstraints; |
use Moose::Util::TypeConstraints; |
33 |
lazy_build => 1, |
lazy_build => 1, |
34 |
); |
); |
35 |
|
|
36 |
|
has 'labels' => ( |
37 |
|
is => 'rw', |
38 |
|
isa => 'HashRef[Str]', |
39 |
|
default => sub { |
40 |
|
my $self = shift; |
41 |
|
$self->load( 'var/design/' . $self->fey_class . '-labels' ) || {} |
42 |
|
}, |
43 |
|
); |
44 |
|
|
45 |
|
|
46 |
sub set_from_hash { |
sub set_from_hash { |
47 |
my ($self, $f) = @_; |
my ($self, $f) = @_; |
48 |
my $attrmap = $self->fey->meta->get_attribute_map if $self->fey; |
my $attrmap = $self->fey->meta->get_attribute_map if $self->fey; |
96 |
|
|
97 |
sub field_label { |
sub field_label { |
98 |
my ( $self, $name ) = @_; |
my ( $self, $name ) = @_; |
99 |
my $label = ucfirst($name); |
my $new_labels = $self->reload( 'var/design/' . $self->fey_class . '-labels' ); |
100 |
|
$self->labels( $new_labels ) if $new_labels; |
101 |
|
my $label = $self->labels->{$name} || ucfirst($name); |
102 |
return $label; |
return $label; |
103 |
} |
} |
104 |
|
|