| 1 | package Rose::HTML::Form::Field::OnOff; | ||||||||||
| 2 | |||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 16 | ▶ | use base 'Rose::HTML::Form::Field::Input'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 16 | ▶ | use Rose::HTML::Form::Constants qw(FF_SEPARATOR); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 16 | our $VERSION = '0.606'; | |||||||||
| 10 | |||||||||||
| 11 | use Rose::Object::MakeMethods::Generic | ||||||||||
| 12 | 16 | ▶ | ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 16 | boolean => 'hidden', | |||||||||
| 14 | 16 | ); | |||||||||
| 15 | |||||||||||
| 16 | 16 | __PACKAGE__->add_required_html_attrs( | |||||||||
| 17 | { | ||||||||||
| 18 | value => 'on', | ||||||||||
| 19 | }); | ||||||||||
| 20 | |||||||||||
| 21 | 444 | ▶ | sub value { shift->html_attr('value', @_) } | ||||||||
|
Subroutine
value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | |||||||||||
| 23 | 2 | ▶ | sub value_label { $_[0]->is_on ? $_[0]->label : undef } | ||||||||
|
Subroutine
value_label: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 230 | ▶ | sub internal_value { $_[0]->is_on ? $_[0]->html_attr('value') : undef } | ||||||||
|
Subroutine
internal_value: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 26 | 54 | ▶ | sub output_value { $_[0]->is_on ? $_[0]->html_attr('value') : undef } | ||||||||
|
Subroutine
output_value: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 5 | ▶ | sub hide { shift->hidden(1) } | ||||||||
|
Subroutine
hide: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 29 | 5 | ▶ | sub show { shift->hidden(0) } | ||||||||
|
Subroutine
show: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | |||||||||||
| 31 | sub group_context_name | ||||||||||
| 32 | 1444 | ▶ | { | ||||||||
|
Subroutine
group_context_name: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 33 | 1444 | my($self) = shift; | |||||||||
| 34 | 1444 | ▶ | my $parent_group = $self->parent_group or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 1041 | ▶ | my $name = $parent_group->fq_name or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 1026 | return $name; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub fq_name | ||||||||||
| 40 | 1332 | ▶ | { | ||||||||
|
Subroutine
fq_name: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | 1332 | my($self) = shift; | |||||||||
| 42 | |||||||||||
| 43 | 1332 | my $name = $self->group_context_name; | |||||||||
| 44 | 1332 | ▶ | $name = $self->local_name unless(defined $name); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | |||||||||||
| 46 | 1332 | return join(FF_SEPARATOR, grep { defined } $self->form_context_name, | |||||||||
| 47 | $self->field_context_name, | ||||||||||
| 48 | $name); | ||||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 16 | my $sep = FF_SEPARATOR; | |||||||||
| 52 | |||||||||||
| 53 | sub fq_moniker | ||||||||||
| 54 | 112 | ▶ | { | ||||||||
|
Subroutine
fq_moniker: called CC=2 SCAR=7.5
Pod
undocumented
| |||||||||||
| 55 | 112 | my($self) = shift; | |||||||||
| 56 | |||||||||||
| 57 | 112 | my $name = $self->group_context_name; | |||||||||
| 58 | |||||||||||
| 59 | 112 | ▶ | if(defined $name) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | { | ||||||||||
| 61 | 0 | my $moniker = $self->local_moniker; | |||||||||
| 62 | 0 | $name =~ s/(?:^|\Q$sep\E)[^$sep]+$/$moniker/o; | |||||||||
| 63 | } | ||||||||||
| 64 | 112 | else { $name = $self->local_moniker } | |||||||||
| 65 | |||||||||||
| 66 | 112 | return join(FF_SEPARATOR, grep { defined } $self->form_context_name, | |||||||||
| 67 | $self->field_context_name, | ||||||||||
| 68 | $name); | ||||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 16 | 1; | |||||||||