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