line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Form::Tiny::Plugin::Diva::MetaRole; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
47
|
use v5.10; |
|
4
|
|
|
|
|
12
|
|
4
|
4
|
|
|
4
|
|
19
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
75
|
|
5
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
141
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.02'; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
19
|
use Moo::Role; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
31
|
|
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
|
|
986
|
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
|
|
1358
|
}; |
|
4
|
|
|
|
|
7
|
|
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
|
131
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return { |
29
|
4
|
|
|
|
|
14
|
%{+DEFAULT_CONFIG}, |
30
|
4
|
|
|
|
|
6
|
%{$self->_diva_config}, |
|
4
|
|
|
|
|
39
|
|
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub add_diva_config |
35
|
|
|
|
|
|
|
{ |
36
|
2
|
|
|
2
|
0
|
1934
|
my ($self, %config) = @_; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
6
|
for my $key (keys %config) { |
39
|
3
|
|
|
|
|
10
|
$self->_diva_config->{$key} = $config{$key}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
6
|
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
|
|
|
|
|
|
|
|