line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Tiny::Plugin::Diva::MetaRole; |
2
|
|
|
|
|
|
|
$Form::Tiny::Plugin::Diva::MetaRole::VERSION = '1.03'; |
3
|
4
|
|
|
4
|
|
52
|
use v5.10; |
|
4
|
|
|
|
|
11
|
|
4
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
81
|
|
5
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
129
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
21
|
use Moo::Role; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
53
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
|
|
1133
|
use constant DEFAULT_CONFIG => { |
10
|
|
|
|
|
|
|
id_base => 'form-field-', |
11
|
|
|
|
|
|
|
label_class => 'form-label', |
12
|
|
|
|
|
|
|
input_class => 'form-control', |
13
|
|
|
|
|
|
|
error_class => 'invalid-feedback', |
14
|
4
|
|
|
4
|
|
1558
|
}; |
|
4
|
|
|
|
|
6
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has '_diva_config' => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
writer => 'set_diva_config', |
19
|
|
|
|
|
|
|
default => sub { {} }, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub diva_config |
23
|
|
|
|
|
|
|
{ |
24
|
4
|
|
|
4
|
0
|
127
|
my ($self) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return { |
27
|
4
|
|
|
|
|
17
|
%{+DEFAULT_CONFIG}, |
28
|
4
|
|
|
|
|
7
|
%{$self->_diva_config}, |
|
4
|
|
|
|
|
61
|
|
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub add_diva_config |
33
|
|
|
|
|
|
|
{ |
34
|
2
|
|
|
2
|
0
|
2172
|
my ($self, %config) = @_; |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
6
|
for my $key (keys %config) { |
37
|
3
|
|
|
|
|
9
|
$self->_diva_config->{$key} = $config{$key}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
4
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
after 'inherit_from' => sub { |
44
|
|
|
|
|
|
|
my ($self, $parent) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
if ($parent->DOES('Form::Tiny::Plugin::Diva::MetaRole')) { |
47
|
|
|
|
|
|
|
$self->set_diva_config({%{$parent->_diva_config}, %{$self->_diva_config}}); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|