82 |
my ( $self ) = @_; |
my ( $self ) = @_; |
83 |
my @required = $self->required; |
my @required = $self->required; |
84 |
if ( ! @required ) { |
if ( ! @required ) { |
85 |
warn "all params available ", dump( $self->params ), " not creating form"; |
warn "all params available ", dump( $self->params ), " not creating form" if $self->debug; |
86 |
return (undef,$self->params) if wantarray; |
return (undef,$self->params) if wantarray; |
87 |
return; |
return; |
88 |
} else { |
} else { |
102 |
my $form; |
my $form; |
103 |
|
|
104 |
foreach my $name ( grep { ! $class->meta->get_attribute($_)->is_lazy } $self->attributes ) { |
foreach my $name ( grep { ! $class->meta->get_attribute($_)->is_lazy } $self->attributes ) { |
105 |
my $attr_type; |
my $attr_type = ''; |
106 |
my $type = $name =~ m/^pass/ ? 'password' : 'text'; |
my $type = $name =~ m/^pass/ ? 'password' : 'text'; |
107 |
my $label = $name; |
my $label = $name; |
108 |
my $value = ''; |
my $value = ''; |
119 |
) . qq|</select>|; |
) . qq|</select>|; |
120 |
$default->{$name} = $config_params->[0]->{$name}; |
$default->{$name} = $config_params->[0]->{$name}; |
121 |
} elsif ( my $attr = $class->meta->get_attribute( $name ) ) { |
} elsif ( my $attr = $class->meta->get_attribute( $name ) ) { |
|
$attr_type = $attr->type_constraint->name; |
|
122 |
if ( $attr->has_type_constraint ) { |
if ( $attr->has_type_constraint ) { |
123 |
|
$attr_type = $attr->type_constraint->name; |
124 |
if ( $attr->type_constraint->can('values') ) { |
if ( $attr->type_constraint->can('values') ) { |
125 |
$value_html = qq|<select name="$name">| . join("\n", |
$value_html = qq|<select name="$name">| . join("\n", |
126 |
map { qq|<option value="$_">$_</option>| } @{ $attr->type_constraint->values } |
map { qq|<option value="$_">$_</option>| } @{ $attr->type_constraint->values } |