Skip to content

Commit aa8ef61

Browse files
authored
Removed option that disable input password and file on edit
When I created this option, I did not expect other people to use, actually, I created to solve my personal problems, but now thinking in community, I'm removing it, because it is not a solution to everybody.
1 parent 0941b15 commit aa8ef61

1 file changed

Lines changed: 1 addition & 58 deletions

File tree

src/View/Helper/FormHelper.php

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -71,68 +71,11 @@ public function input($fieldName, array $options = []) {
7171
break;
7272
case 'file':
7373
$options['templates']['inputContainer'] = '<div class="form-group {{type}}{{required}}">{{content}}</div>';
74-
$options['templates']['label'] = '<label>{{input}}{{text}}</label>';
75-
if (!empty($options['value'])) {
76-
$label = $options['label'] ? $options['label'] : Inflector::humanize($fieldName);
77-
$function_name = "enable_{$fieldName}()";
78-
79-
$options['templates']['inputContainer'] = '<div class="form-group {{type}}{{required}}">
80-
{{content}}
81-
<div>
82-
<small>
83-
<label>
84-
<input type="checkbox" onclick="'.$function_name.'" />
85-
'. __("Click here to change the file.").'
86-
</label>
87-
</small>
88-
89-
<script type="text/javascript">
90-
function '.$function_name.' {
91-
if (document.getElementById("'.$fieldName.'").disabled) {
92-
document.getElementById("'.$fieldName.'").disabled = false;
93-
} else {
94-
document.getElementById("'.$fieldName.'").disabled = true;
95-
}
96-
}
97-
</script>
98-
</div>
99-
</div>';
100-
101-
$options['disabled'] = true;
102-
}
74+
$options['templates']['label'] = isset($options['templates']['label']) ? $options['templates']['label'] : '<label>{{input}}{{text}}</label>';
10375
break;
10476
case 'password':
10577
$options['templates']['inputContainer'] = '<div class="form-group {{type}}{{required}}">{{content}}</div>';
10678
$options['templates']['label'] = isset($options['templates']['label']) ? $options['templates']['label'] : '<label>{{input}}{{text}}</label>';
107-
if (!empty($options['value'])) {
108-
$label = $options['label'] ? $options['label'] : Inflector::humanize($fieldName);
109-
$function_name = "enable_{$fieldName}()";
110-
111-
$options['templates']['inputContainer'] = '<div class="form-group {{type}}{{required}}">
112-
{{content}}
113-
<div>
114-
<small>
115-
<label>
116-
<input type="checkbox" onclick="'.$function_name.'" />
117-
'. __("Click here to change the password.").'
118-
</label>
119-
</small>
120-
121-
<script type="text/javascript">
122-
function '.$function_name.' {
123-
if (document.getElementById("'.$fieldName.'").disabled) {
124-
document.getElementById("'.$fieldName.'").disabled = false;
125-
} else {
126-
document.getElementById("'.$fieldName.'").disabled = true;
127-
}
128-
}
129-
</script>
130-
</div>
131-
</div>';
132-
133-
$options['disabled'] = true;
134-
$options['value'] = '';
135-
}
13679
break;
13780
default:
13881
}

0 commit comments

Comments
 (0)