| 1 | package Form::Factory::Action::Meta::Attribute::Control; | ||||||||||
| 2 | 1 | $Form::Factory::Action::Meta::Attribute::Control::VERSION = '0.022'; | |||||||||
| 3 | 1 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | # ABSTRACT: Form control attribute-traits | ||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 1 | has placement => ( | |||||||||
| 9 | is => 'ro', | ||||||||||
| 10 | isa => 'Num', | ||||||||||
| 11 | required => 1, | ||||||||||
| 12 | default => 0, | ||||||||||
| 13 | ); | ||||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | 1 | has control => ( | |||||||||
| 17 | is => 'ro', | ||||||||||
| 18 | isa => 'Str', | ||||||||||
| 19 | required => 1, | ||||||||||
| 20 | default => 'text', | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | has options => ( | ||||||||||
| 25 | is => 'ro', | ||||||||||
| 26 | isa => 'HashRef', | ||||||||||
| 27 | required => 1, | ||||||||||
| 28 | 0 | ▶ | default => sub { {} }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | 1 | ); | |||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | has features => ( | ||||||||||
| 33 | is => 'ro', | ||||||||||
| 34 | isa => 'HashRef[HashRef]', | ||||||||||
| 35 | required => 1, | ||||||||||
| 36 | 0 | ▶ | default => sub { {} }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 37 | 1 | ); | |||||||||
| 38 | |||||||||||
| 39 | |||||||||||
| 40 | 32 | ▶ | around new => sub { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 41 | 32 | my ($next, $class, $name, %options) = @_; | |||||||||
| 42 | |||||||||||
| 43 | 32 | my $meta = delete $options{__meta}; | |||||||||
| 44 | |||||||||||
| 45 | 32 | my $real_name = $name; | |||||||||
| 46 | 32 | $real_name =~ s/^\+//; | |||||||||
| 47 | |||||||||||
| 48 | 32 | for my $feature_name (keys %{ $options{features} }) { | |||||||||
| 49 | 21 | my $feature_class = Form::Factory->control_feature_class($feature_name); | |||||||||
| 50 | 21 | ▶ | next unless $feature_class->does('Form::Factory::Feature::Role::BuildAttribute'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | |||||||||||
| 52 | $feature_class->build_attribute( | ||||||||||
| 53 | 4 | $options{features}{$feature_name}, $meta, $real_name, \%options | |||||||||
| 54 | ); | ||||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 32 | $class->$next($name, %options); | |||||||||
| 58 | 1 | }; | |||||||||
| 59 | |||||||||||
| 60 | |||||||||||
| 61 | 1 | ▶ | around clone_and_inherit_options => sub { | ||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||
| 62 | 1 | my ($next, $self, %options) = @_; | |||||||||
| 63 | |||||||||||
| 64 | # Merge features | ||||||||||
| 65 | 1 | ▶ | if ($options{features}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | 1 | my $parent_features = $self->features; | |||||||||
| 67 | 1 | my $child_features = $options{features}; | |||||||||
| 68 | |||||||||||
| 69 | 1 | $options{features} = { %$parent_features, %$child_features }; | |||||||||
| 70 | 1 | for my $key (keys %{ $options{features} }) { | |||||||||
| 71 | 4 | ▶ | delete $options{features}{$key} unless $options{features}{$key}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | } | ||||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 1 | $self->$next(%options); | |||||||||
| 76 | 1 | }; | |||||||||
| 77 | |||||||||||
| 78 | |||||||||||
| 79 | package Moose::Meta::Attribute::Custom::Trait::Form::Control; | ||||||||||
| 80 | 1 | $Moose::Meta::Attribute::Custom::Trait::Form::Control::VERSION = '0.022'; | |||||||||
| 81 | 1 | ▶ | sub register_implementation { 'Form::Factory::Action::Meta::Attribute::Control' } | ||||||||
|
Subroutine
register_implementation: called CC=1 SCAR=0.0
| |||||||||||
| 82 | |||||||||||
| 83 | 1 | 1; | |||||||||
| 84 | |||||||||||
| 85 | __END__ | ||||||||||