134 |
$default->{$name} = $config_params->[0]->{$name}; |
$default->{$name} = $config_params->[0]->{$name}; |
135 |
} elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) { |
} elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) { |
136 |
$value_html = select_values( $name, $attr_type, $attr->type_constraint->values ); |
$value_html = select_values( $name, $attr_type, $attr->type_constraint->values ); |
137 |
|
} elsif ( $attr_type =~ m{^Bool} ) { |
138 |
|
my $suffix = ''; |
139 |
|
$suffix = ' checked' if $value; |
140 |
|
$value_html = qq|<input type="checkbox" name="$name" title="$attr_type" value="$value"$suffix>|; |
141 |
} elsif ( $attr_type !~ m{^(Str|Int)$} ) { |
} elsif ( $attr_type !~ m{^(Str|Int)$} ) { |
142 |
$value_html = qq|<textarea name="$name" title="$attr_type">$value</textarea>|; |
$value_html = qq|<textarea name="$name" title="$attr_type">$value</textarea>|; |
143 |
} |
} |
146 |
|
|
147 |
$default->{$name} = $value unless defined $default->{$name}; |
$default->{$name} = $value unless defined $default->{$name}; |
148 |
|
|
149 |
if ( ! $value_html ) { |
$value_html = qq|<input type="$type" name="$name" title="$attr_type" value="$value">| unless $value_html; |
|
my $suffix = ''; |
|
|
if ( $attr_type =~ m{^Bool$} ) { |
|
|
$type = 'checkbox'; |
|
|
$suffix = ' checked' if $value; |
|
|
} |
|
|
$value_html = qq|<input type="$type" name="$name" title="$attr_type" value="$value"$suffix>|; |
|
|
} |
|
150 |
|
|
151 |
# warn "# required $name ", $class->meta->get_attribute( $name )->dump( 2 ); |
# warn "# required $name ", $class->meta->get_attribute( $name )->dump( 2 ); |
152 |
$form .= qq|<label for="$name"$label_title>$label</label>| . $value_html; |
$form .= qq|<label for="$name"$label_title>$label</label>| . $value_html; |